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

Delta Between Two Patch Sets: src/org/adblockplus/android/Preferences.java

Issue 6196972490850304: Make the Acceptable Ads link clickable (Closed)
Left Patch Set: Fix issues Created Nov. 26, 2013, 10:24 a.m.
Right Patch Set: Encode URL Created Nov. 26, 2013, 1:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/org/adblockplus/android/AdblockPlus.java ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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("&lt;a&gt;(.*?)&lt;/a&gt;", "<a href=\"" + url + "\">$1</a >"); 159 .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.
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
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld