Left: | ||
Right: |
OLD | NEW |
---|---|
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; |
49 import android.text.method.LinkMovementMethod; | |
48 import android.util.Log; | 50 import android.util.Log; |
49 import android.view.View; | 51 import android.view.View; |
50 import android.view.ViewGroup; | 52 import android.view.ViewGroup; |
51 import android.widget.TextView; | 53 import android.widget.TextView; |
52 | 54 |
53 import com.actionbarsherlock.view.Menu; | 55 import com.actionbarsherlock.view.Menu; |
54 import com.actionbarsherlock.view.MenuInflater; | 56 import com.actionbarsherlock.view.MenuInflater; |
55 import com.actionbarsherlock.view.MenuItem; | 57 import com.actionbarsherlock.view.MenuItem; |
56 | 58 |
57 /** | 59 /** |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 if (subscriptions.length > 0) | 146 if (subscriptions.length > 0) |
145 { | 147 { |
146 current = subscriptions[0]; | 148 current = subscriptions[0]; |
147 } | 149 } |
148 | 150 |
149 boolean firstRun = firstRunActionsPending && application.isFirstRun(); | 151 boolean firstRun = firstRunActionsPending && application.isFirstRun(); |
150 firstRunActionsPending = false; | 152 firstRunActionsPending = false; |
151 | 153 |
152 if (firstRun && current != null) | 154 if (firstRun && current != null) |
153 { | 155 { |
154 new AlertDialog.Builder(this).setTitle(R.string.app_name) | 156 final String url = application.getAcceptableAdsUrl(); |
155 .setMessage(String.format(getString(R.string.msg_subscription_offer, c urrent.title))) | 157 final String rawMessage = String.format(getString(R.string.msg_subscriptio n_offer, current.title)); |
158 final String message = TextUtils.htmlEncode(rawMessage) | |
159 .replaceAll("<a>(.*?)</a>", "<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.
| |
160 final TextView messageView = new TextView(this); | |
161 messageView.setText(Html.fromHtml(message)); | |
162 messageView.setMovementMethod(LinkMovementMethod.getInstance()); | |
163 final int padding = 10; | |
164 messageView.setPadding(padding, padding, padding, padding); | |
165 new AlertDialog.Builder(this).setTitle(R.string.install_name) | |
166 .setView(messageView) | |
156 .setIcon(android.R.drawable.ic_dialog_info) | 167 .setIcon(android.R.drawable.ic_dialog_info) |
157 .setPositiveButton(R.string.ok, null).create().show(); | 168 .setPositiveButton(R.string.ok, null).create().show(); |
158 } | 169 } |
159 | 170 |
160 // Enable manual subscription refresh | 171 // Enable manual subscription refresh |
161 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() | 172 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() |
162 { | 173 { |
163 @Override | 174 @Override |
164 public void onClick(View v) | 175 public void onClick(View v) |
165 { | 176 { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 showConfigurationMsg(getString(R.string.msg_configuration)); | 546 showConfigurationMsg(getString(R.string.msg_configuration)); |
536 } | 547 } |
537 | 548 |
538 public void onServiceDisconnected(ComponentName className) | 549 public void onServiceDisconnected(ComponentName className) |
539 { | 550 { |
540 proxyService = null; | 551 proxyService = null; |
541 Log.d(TAG, "Proxy service disconnected"); | 552 Log.d(TAG, "Proxy service disconnected"); |
542 } | 553 } |
543 }; | 554 }; |
544 } | 555 } |
OLD | NEW |