Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
LEFT | RIGHT |