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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 if (subscriptions.length > 0) | 146 if (subscriptions.length > 0) |
147 { | 147 { |
148 current = subscriptions[0]; | 148 current = subscriptions[0]; |
149 } | 149 } |
150 | 150 |
151 boolean firstRun = firstRunActionsPending && application.isFirstRun(); | 151 boolean firstRun = firstRunActionsPending && application.isFirstRun(); |
152 firstRunActionsPending = false; | 152 firstRunActionsPending = false; |
153 | 153 |
154 if (firstRun && current != null) | 154 if (firstRun && current != null) |
155 { | 155 { |
156 final String url = application.getAcceptableAdsUrl(); | 156 final String url = TextUtils.htmlEncode(application.getAcceptableAdsUrl()) ; |
157 final String rawMessage = String.format(getString(R.string.msg_subscriptio n_offer, current.title)); | 157 final String rawMessage = String.format(getString(R.string.msg_subscriptio n_offer, current.title)); |
158 final String message = TextUtils.htmlEncode(rawMessage) | 158 final String message = TextUtils.htmlEncode(rawMessage) |
159 .replaceAll("<a>(.*?)</a>", "<a href=\"" + url + "\">$1</a >"); | 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); | 160 final TextView messageView = new TextView(this); |
161 messageView.setText(Html.fromHtml(message)); | 161 messageView.setText(Html.fromHtml(message)); |
162 messageView.setMovementMethod(LinkMovementMethod.getInstance()); | 162 messageView.setMovementMethod(LinkMovementMethod.getInstance()); |
163 final int padding = 10; | 163 final int padding = 10; |
164 messageView.setPadding(padding, padding, padding, padding); | 164 messageView.setPadding(padding, padding, padding, padding); |
165 new AlertDialog.Builder(this).setTitle(R.string.install_name) | 165 new AlertDialog.Builder(this).setTitle(R.string.install_name) |
166 .setView(messageView) | 166 .setView(messageView) |
167 .setIcon(android.R.drawable.ic_dialog_info) | 167 .setIcon(android.R.drawable.ic_dialog_info) |
168 .setPositiveButton(R.string.ok, null).create().show(); | 168 .setPositiveButton(R.string.ok, null).create().show(); |
169 } | 169 } |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 showConfigurationMsg(getString(R.string.msg_configuration)); | 546 showConfigurationMsg(getString(R.string.msg_configuration)); |
547 } | 547 } |
548 | 548 |
549 public void onServiceDisconnected(ComponentName className) | 549 public void onServiceDisconnected(ComponentName className) |
550 { | 550 { |
551 proxyService = null; | 551 proxyService = null; |
552 Log.d(TAG, "Proxy service disconnected"); | 552 Log.d(TAG, "Proxy service disconnected"); |
553 } | 553 } |
554 }; | 554 }; |
555 } | 555 } |
LEFT | RIGHT |