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

Delta Between Two Patch Sets: mobile/android/thirdparty/org/adblockplus/browser/MoreSubscriptionsPreferenceGroup.java

Issue 29505606: Issue 5360 - Whitelist subscription shown as '-user-35236' (Closed)
Left Patch Set: Created Aug. 4, 2017, 6:57 p.m.
Right Patch Set: Adjustments in code style Created Aug. 7, 2017, 7:22 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 | « no previous file | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Log.d(TAG, "Adding: " + url); 274 Log.d(TAG, "Adding: " + url);
275 this.addNewSubscription(url); 275 this.addNewSubscription(url);
276 } 276 }
277 277
278 private static class ActiveSubscriptionContainer implements AdblockPlusApiCall back 278 private static class ActiveSubscriptionContainer implements AdblockPlusApiCall back
279 { 279 {
280 public final HashMap<String, String> enabledSubscriptions = new HashMap<Stri ng, String>(); 280 public final HashMap<String, String> enabledSubscriptions = new HashMap<Stri ng, String>();
281 private final Semaphore entriesReady = new Semaphore(0); 281 private final Semaphore entriesReady = new Semaphore(0);
282 private final Context context; 282 private final Context context;
283 283
284 ActiveSubscriptionContainer(Context context) { 284 ActiveSubscriptionContainer(Context context)
anton 2017/08/07 09:40:16 `{` should be in the next line
diegocarloslima 2017/08/07 11:07:34 Acknowledged.
285 {
285 this.context = context; 286 this.context = context;
286 } 287 }
287 288
288 public void refresh() 289 public void refresh()
289 { 290 {
290 AddOnBridge.queryActiveSubscriptions(this); 291 AddOnBridge.queryActiveSubscriptions(this);
291 this.entriesReady.acquireUninterruptibly(); 292 this.entriesReady.acquireUninterruptibly();
292 } 293 }
293 294
294 @Override 295 @Override
295 public void onApiRequestSucceeded(NativeJSObject jsObject) 296 public void onApiRequestSucceeded(NativeJSObject jsObject)
296 { 297 {
297 try 298 try
298 { 299 {
299 this.enabledSubscriptions.clear(); 300 this.enabledSubscriptions.clear();
300 if (jsObject.getBoolean("success")) 301 if (jsObject.getBoolean("success"))
301 { 302 {
302 NativeJSObject[] subs = jsObject.getObjectArray("value"); 303 NativeJSObject[] subs = jsObject.getObjectArray("value");
303 for (int i = 0; i < subs.length; i++) 304 for (int i = 0; i < subs.length; i++)
304 { 305 {
305 final String url = subs[i].getString("url"); 306 final String url = subs[i].getString("url");
306 307
307 String title = subs[i].has("title") ? subs[i].getString("title") : u rl; 308 String title = subs[i].has("title") ? subs[i].getString("title") : u rl;
308 if(title.startsWith("~user~")) { 309 if (title.startsWith("~user~"))
anton 2017/08/07 09:40:16 space expected between `if` and `(`
anton 2017/08/07 09:40:16 `{` is expected to be in the next line
diegocarloslima 2017/08/07 11:07:34 Acknowledged.
310 {
309 title = this.context.getString(R.string.abb_pref_category_whitelis ted_sites); 311 title = this.context.getString(R.string.abb_pref_category_whitelis ted_sites);
310 } 312 }
311 313
312 if (!IGNORED_URLS.contains(url)) 314 if (!IGNORED_URLS.contains(url))
313 { 315 {
314 Log.d(TAG, "Adding: " + url + ", " + title); 316 Log.d(TAG, "Adding: " + url + ", " + title);
315 this.enabledSubscriptions.put(url, title); 317 this.enabledSubscriptions.put(url, title);
316 } 318 }
317 } 319 }
318 } 320 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // ignored 361 // ignored
360 } 362 }
361 363
362 @Override 364 @Override
363 public void onApiRequestFailed(String errorMessage) 365 public void onApiRequestFailed(String errorMessage)
364 { 366 {
365 // ignored 367 // ignored
366 } 368 }
367 } 369 }
368 } 370 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld