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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 showNotificationDialog(getString(R.string.install_name), | 156 showNotificationDialog(getString(R.string.install_name), |
157 String.format(getString(R.string.msg_subscription_offer, current.title )), | 157 String.format(getString(R.string.msg_subscription_offer, current.title )), |
158 application.getAcceptableAdsUrl()); | 158 application.getAcceptableAdsUrl()); |
159 application.setNotifiedAboutAcceptableAds(true); | 159 application.setNotifiedAboutAcceptableAds(true); |
160 application.setAcceptableAdsEnabled(true); | 160 application.setAcceptableAdsEnabled(true); |
161 } | 161 } |
162 else if (!application.isNotifiedAboutAcceptableAds()) | 162 else if (!application.isNotifiedAboutAcceptableAds()) |
Wladimir Palant
2013/11/26 11:01:02
Shouldn't you check whether acceptable ads are alr
Felix Dahlke
2013/11/26 13:59:31
Why? Even if they were, we want to notify every us
| |
163 { | 163 { |
164 showNotificationDialog(getString(R.string.acceptableads_name), | 164 showNotificationDialog(getString(R.string.acceptableads_name), |
165 getString(R.string.msg_acceptable_ads), application.getAcceptableAdsUr l()); | 165 getString(R.string.msg_acceptable_ads), application.getAcceptableAdsUr l()); |
Wladimir Palant
2013/11/26 11:01:02
Style nit: add a line break to put the last parame
Felix Dahlke
2013/11/26 13:59:31
I'm wrapping Java code to 100 columns currently, a
| |
166 application.setNotifiedAboutAcceptableAds(true); | 166 application.setNotifiedAboutAcceptableAds(true); |
167 application.setAcceptableAdsEnabled(true); | 167 application.setAcceptableAdsEnabled(true); |
168 } | 168 } |
169 | 169 |
170 // Enable manual subscription refresh | 170 // Enable manual subscription refresh |
171 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() | 171 subscriptionList.setOnRefreshClickListener(new View.OnClickListener() |
172 { | 172 { |
173 @Override | 173 @Override |
174 public void onClick(View v) | 174 public void onClick(View v) |
175 { | 175 { |
(...skipping 28 matching lines...) Expand all Loading... | |
204 if (enabled || firstRun) | 204 if (enabled || firstRun) |
205 setFilteringEnabled(true); | 205 setFilteringEnabled(true); |
206 if (enabled || firstRun || (proxyenabled && !autoconfigured)) | 206 if (enabled || firstRun || (proxyenabled && !autoconfigured)) |
207 setProxyEnabled(true); | 207 setProxyEnabled(true); |
208 | 208 |
209 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0) ; | 209 bindService(new Intent(this, ProxyService.class), proxyServiceConnection, 0) ; |
210 } | 210 } |
211 | 211 |
212 private void showNotificationDialog(String title, String message, String url) | 212 private void showNotificationDialog(String title, String message, String url) |
213 { | 213 { |
214 url = TextUtils.htmlEncode(url); | |
214 message = TextUtils.htmlEncode(message) | 215 message = TextUtils.htmlEncode(message) |
215 .replaceAll("<a>(.*?)</a>", "<a href=\"" + url + "\">$1</a>" ); | 216 .replaceAll("<a>(.*?)</a>", "<a href=\"" + url + "\">$1</a>" ); |
Wladimir Palant
2013/11/26 11:01:02
Comment from previous review (encode entities in U
Felix Dahlke
2013/11/26 13:59:31
Done.
| |
216 final TextView messageView = new TextView(this); | 217 final TextView messageView = new TextView(this); |
217 messageView.setText(Html.fromHtml(message)); | 218 messageView.setText(Html.fromHtml(message)); |
218 messageView.setMovementMethod(LinkMovementMethod.getInstance()); | 219 messageView.setMovementMethod(LinkMovementMethod.getInstance()); |
219 final int padding = 10; | 220 final int padding = 10; |
220 messageView.setPadding(padding, padding, padding, padding); | 221 messageView.setPadding(padding, padding, padding, padding); |
221 new AlertDialog.Builder(this).setTitle(title) | 222 new AlertDialog.Builder(this).setTitle(title) |
222 .setView(messageView) | 223 .setView(messageView) |
223 .setIcon(android.R.drawable.ic_dialog_info) | 224 .setIcon(android.R.drawable.ic_dialog_info) |
224 .setPositiveButton(R.string.ok, null).create().show(); | 225 .setPositiveButton(R.string.ok, null).create().show(); |
225 } | 226 } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 showConfigurationMsg(getString(R.string.msg_configuration)); | 561 showConfigurationMsg(getString(R.string.msg_configuration)); |
561 } | 562 } |
562 | 563 |
563 public void onServiceDisconnected(ComponentName className) | 564 public void onServiceDisconnected(ComponentName className) |
564 { | 565 { |
565 proxyService = null; | 566 proxyService = null; |
566 Log.d(TAG, "Proxy service disconnected"); | 567 Log.d(TAG, "Proxy service disconnected"); |
567 } | 568 } |
568 }; | 569 }; |
569 } | 570 } |
LEFT | RIGHT |