Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/Preferences.java

Issue 6196972490850304: Make the Acceptable Ads link clickable (Closed)
Patch Set: Fix issues Created Nov. 26, 2013, 10:24 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« jni/abpEngine.cpp ('K') | « src/org/adblockplus/android/AdblockPlus.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/Preferences.java
===================================================================
--- a/src/org/adblockplus/android/Preferences.java
+++ b/src/org/adblockplus/android/Preferences.java
@@ -44,7 +44,9 @@
import android.preference.ListPreference;
import android.preference.PreferenceManager;
import android.text.Html;
+import android.text.TextUtils;
import android.text.format.DateFormat;
+import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -151,8 +153,17 @@
if (firstRun && current != null)
{
- new AlertDialog.Builder(this).setTitle(R.string.app_name)
- .setMessage(String.format(getString(R.string.msg_subscription_offer, current.title)))
+ final String url = application.getAcceptableAdsUrl();
+ final String rawMessage = String.format(getString(R.string.msg_subscription_offer, current.title));
+ final String message = TextUtils.htmlEncode(rawMessage)
+ .replaceAll("&lt;a&gt;(.*?)&lt;/a&gt;", "<a href=\"" + url + "\">$1</a>");
Wladimir Palant 2013/11/26 10:48:57 TextUtils.htmlEncode(url)?
Felix Dahlke 2013/11/26 13:11:46 Why? That'd just mess up the link and it wouldn't
Wladimir Palant 2013/11/26 13:33:44 No, it will make sure the link is properly encoded
Felix Dahlke 2013/11/26 13:48:01 Ouch, you're right.
+ final TextView messageView = new TextView(this);
+ messageView.setText(Html.fromHtml(message));
+ messageView.setMovementMethod(LinkMovementMethod.getInstance());
+ final int padding = 10;
+ messageView.setPadding(padding, padding, padding, padding);
+ new AlertDialog.Builder(this).setTitle(R.string.install_name)
+ .setView(messageView)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton(R.string.ok, null).create().show();
}
« jni/abpEngine.cpp ('K') | « src/org/adblockplus/android/AdblockPlus.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld