Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 26 matching lines...) Expand all Loading... | |
37 import android.content.SharedPreferences; | 37 import android.content.SharedPreferences; |
38 import android.content.pm.PackageManager.NameNotFoundException; | 38 import android.content.pm.PackageManager.NameNotFoundException; |
39 import android.content.res.AssetManager; | 39 import android.content.res.AssetManager; |
40 import android.net.Uri; | 40 import android.net.Uri; |
41 import android.os.Build; | 41 import android.os.Build; |
42 import android.os.Bundle; | 42 import android.os.Bundle; |
43 import android.os.IBinder; | 43 import android.os.IBinder; |
44 import android.preference.ListPreference; | 44 import android.preference.ListPreference; |
45 import android.preference.PreferenceManager; | 45 import android.preference.PreferenceManager; |
46 import android.text.Html; | 46 import android.text.Html; |
47 import android.text.TextUtils; | |
47 import android.text.format.DateFormat; | 48 import android.text.format.DateFormat; |
48 import android.text.method.LinkMovementMethod; | 49 import android.text.method.LinkMovementMethod; |
49 import android.util.Log; | 50 import android.util.Log; |
50 import android.view.View; | 51 import android.view.View; |
51 import android.view.ViewGroup; | 52 import android.view.ViewGroup; |
52 import android.widget.TextView; | 53 import android.widget.TextView; |
53 | 54 |
54 import com.actionbarsherlock.view.Menu; | 55 import com.actionbarsherlock.view.Menu; |
55 import com.actionbarsherlock.view.MenuInflater; | 56 import com.actionbarsherlock.view.MenuInflater; |
56 import com.actionbarsherlock.view.MenuItem; | 57 import com.actionbarsherlock.view.MenuItem; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 if (subscriptions.length > 0) | 146 if (subscriptions.length > 0) |
146 { | 147 { |
147 current = subscriptions[0]; | 148 current = subscriptions[0]; |
148 } | 149 } |
149 | 150 |
150 boolean firstRun = firstRunActionsPending && application.isFirstRun(); | 151 boolean firstRun = firstRunActionsPending && application.isFirstRun(); |
151 firstRunActionsPending = false; | 152 firstRunActionsPending = false; |
152 | 153 |
153 if (firstRun && current != null) | 154 if (firstRun && current != null) |
154 { | 155 { |
155 final String message = String.format(getString(R.string.msg_subscription_o ffer, current.title)) | 156 final String url = TextUtils.htmlEncode(application.getAcceptableAdsUrl()) ; |
156 .replace("<a>", "<a href=\"" + getString(R.string.acceptable_ads_url) + "\">"); | 157 final String rawMessage = String.format(getString(R.string.msg_subscriptio n_offer, current.title)); |
Wladimir Palant
2013/11/26 09:35:54
This is a security vulnerability, please don't all
Felix Dahlke
2013/11/26 10:25:50
Done. I had a feeling I wouldn't get away with thi
| |
158 final String message = TextUtils.htmlEncode(rawMessage) | |
159 .replaceAll("<a>(.*?)</a>", "<a href=\"" + url + "\">$1</a >"); | |
157 final TextView messageView = new TextView(this); | 160 final TextView messageView = new TextView(this); |
158 messageView.setText(Html.fromHtml(message)); | 161 messageView.setText(Html.fromHtml(message)); |
159 messageView.setMovementMethod(LinkMovementMethod.getInstance()); | 162 messageView.setMovementMethod(LinkMovementMethod.getInstance()); |
160 final int padding = 10; | 163 final int padding = 10; |
Felix Dahlke
2013/11/26 09:21:52
I'm not a big fan of hard coding style properties,
| |
161 messageView.setPadding(padding, padding, padding, padding); | 164 messageView.setPadding(padding, padding, padding, padding); |
162 new AlertDialog.Builder(this).setTitle(R.string.install_name) | 165 new AlertDialog.Builder(this).setTitle(R.string.install_name) |
163 .setView(messageView) | 166 .setView(messageView) |
164 .setIcon(android.R.drawable.ic_dialog_info) | 167 .setIcon(android.R.drawable.ic_dialog_info) |
165 .setPositiveButton(R.string.ok, null).create().show(); | 168 .setPositiveButton(R.string.ok, null).create().show(); |
166 } | 169 } |
167 | 170 |
168 // Enable manual subscription refresh | 171 // Enable manual subscription refresh |
169 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() | 172 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() |
170 { | 173 { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 showConfigurationMsg(getString(R.string.msg_configuration)); | 546 showConfigurationMsg(getString(R.string.msg_configuration)); |
544 } | 547 } |
545 | 548 |
546 public void onServiceDisconnected(ComponentName className) | 549 public void onServiceDisconnected(ComponentName className) |
547 { | 550 { |
548 proxyService = null; | 551 proxyService = null; |
549 Log.d(TAG, "Proxy service disconnected"); | 552 Log.d(TAG, "Proxy service disconnected"); |
550 } | 553 } |
551 }; | 554 }; |
552 } | 555 } |
LEFT | RIGHT |