From 45b6bfcccc331d62c6984aea789cee6677144518 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 17 Aug 2014 11:47:14 +0200 Subject: Make link in IodineVpnException message clickable #4 --- src/org/xapek/andiodine/FragmentStatus.java | 11 ++++++++++- src/org/xapek/andiodine/IodineVpnService.java | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/org/xapek') diff --git a/src/org/xapek/andiodine/FragmentStatus.java b/src/org/xapek/andiodine/FragmentStatus.java index 198271a..ee14562 100644 --- a/src/org/xapek/andiodine/FragmentStatus.java +++ b/src/org/xapek/andiodine/FragmentStatus.java @@ -7,6 +7,9 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; +import android.text.SpannableString; +import android.text.method.LinkMovementMethod; +import android.text.util.Linkify; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -28,10 +31,16 @@ public class FragmentStatus extends Fragment { public void onReceive(Context context, Intent intent) { Log.d(TAG, "Got intent: " + intent); if (IodineVpnService.ACTION_STATUS_ERROR.equals(intent.getAction())) { + final TextView message = new TextView(context); + final String stringMessage = intent.getStringExtra(IodineVpnService.EXTRA_ERROR_MESSAGE); + final SpannableString s = new SpannableString(stringMessage); + Linkify.addLinks(s, Linkify.WEB_URLS); + message.setText(s); + message.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(FragmentStatus.this.getActivity())// .setIcon(R.drawable.error) // .setTitle("Error") // - .setMessage(intent.getStringExtra(IodineVpnService.EXTRA_ERROR_MESSAGE)) // + .setView(message) .create() // .show(); } else if (IodineVpnService.ACTION_STATUS_CONNECT.equals(intent.getAction())) { diff --git a/src/org/xapek/andiodine/IodineVpnService.java b/src/org/xapek/andiodine/IodineVpnService.java index 7c4443e..dcc3715 100644 --- a/src/org/xapek/andiodine/IodineVpnService.java +++ b/src/org/xapek/andiodine/IodineVpnService.java @@ -323,9 +323,8 @@ public class IodineVpnService extends VpnService implements Runnable { parcelFD = b.establish(); } catch (Exception e) { if (e.getMessage().contains("fwmark") || e.getMessage().contains("iptables")) { - // bug https://github.com/yvesf/andiodine/issues/4 throw new IodineVpnException( - "Error while creating interface, please check issue #4 at https://github.com/yvesf/andiodine/issues/4"); + "Error while creating interface, please check issue #9 at https://github.com/yvesf/andiodine/issues/9"); } else { throw new IodineVpnException("Error while creating interface: " + e.getMessage()); -- cgit v1.2.1