| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 public void subscriptionStateChanged() | 251 public void subscriptionStateChanged() |
| 252 { | 252 { |
| 253 if (this.subscriptionUpdateCallback != null) | 253 if (this.subscriptionUpdateCallback != null) |
| 254 { | 254 { |
| 255 subscriptionUpdateCallback.subscriptionUpdatedApplied(); | 255 subscriptionUpdateCallback.subscriptionUpdatedApplied(); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 public void createAndAddSubscriptionFromUrl(final String url, final Subscripti
onAddedCallback callback) throws IOException | 259 public void createAndAddSubscriptionFromUrl(final String url, |
| 260 final SubscriptionAddedCallback callback) throws IOException |
| 260 { | 261 { |
| 261 final Subscription sub = Subscription.create(url); | 262 final Subscription sub = Subscription.create(url); |
| 262 sub.putMeta(Subscription.KEY_TITLE, url); | 263 sub.putMeta(Subscription.KEY_TITLE, url); |
| 263 sub.setEnabled(true); | 264 sub.setEnabled(true); |
| 264 subscriptions.add(sub); | 265 subscriptions.add(sub); |
| 265 subscriptions.persistSubscription(sub); | 266 subscriptions.persistSubscription(sub); |
| 266 callback.subscriptionAdded(); | 267 callback.subscriptionAdded(); |
| 267 } | 268 } |
| 268 | 269 |
| 269 public void removeSubscriptionById(final String subscriptionId) | 270 public void removeSubscriptionById(final String subscriptionId) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 engine.wasFirstRun = engine.subscriptions.wasUnitialized(); | 418 engine.wasFirstRun = engine.subscriptions.wasUnitialized(); |
| 418 if (engine.subscriptions.wasUnitialized()) | 419 if (engine.subscriptions.wasUnitialized()) |
| 419 { | 420 { |
| 420 Log.d(TAG, "Subscription storage was uninitialized, initializing..."); | 421 Log.d(TAG, "Subscription storage was uninitialized, initializing..."); |
| 421 | 422 |
| 422 try (final InputStream easylistTxt = context.getResources().openRawResourc
e(R.raw.easylist)) | 423 try (final InputStream easylistTxt = context.getResources().openRawResourc
e(R.raw.easylist)) |
| 423 { | 424 { |
| 424 final Subscription easylist = engine.subscriptions.add(Subscription | 425 final Subscription easylist = engine.subscriptions.add(Subscription |
| 425 // Use bundled EasyList as default and update it with locale specifi
c list later | 426 // Use bundled EasyList as default and update it with locale specifi
c list later |
| 426 // see: https://issues.adblockplus.org/ticket/5237 | 427 // see: https://issues.adblockplus.org/ticket/5237 |
| 427 .create(SubscriptionUtils.chooseDefaultSubscriptionUrl(engine.defaul
tSubscriptions.getAdsSubscriptions())) | 428 .create(SubscriptionUtils.chooseDefaultSubscriptionUrl( |
| 429 engine.defaultSubscriptions.getAdsSubscriptions())) |
| 428 .parseLines(readLines(easylistTxt))); | 430 .parseLines(readLines(easylistTxt))); |
| 429 easylist.putMeta(Subscription.KEY_UPDATE_TIMESTAMP, "0"); | 431 easylist.putMeta(Subscription.KEY_UPDATE_TIMESTAMP, "0"); |
| 430 easylist.setEnabled(true); | 432 easylist.setEnabled(true); |
| 431 } | 433 } |
| 432 Log.d(TAG, "Added and enabled bundled easylist"); | 434 Log.d(TAG, "Added and enabled bundled easylist"); |
| 433 | 435 |
| 434 try (final InputStream exceptionsTxt = context.getResources() | 436 try (final InputStream exceptionsTxt = context.getResources() |
| 435 .openRawResource(R.raw.exceptionrules)) | 437 .openRawResource(R.raw.exceptionrules)) |
| 436 { | 438 { |
| 437 final Subscription exceptions = engine.subscriptions.add(Subscription | 439 final Subscription exceptions = engine.subscriptions.add(Subscription |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 { | 808 { |
| 807 void subscriptionUpdateRequested(boolean enabled); | 809 void subscriptionUpdateRequested(boolean enabled); |
| 808 void subscriptionUpdatedApplied(); | 810 void subscriptionUpdatedApplied(); |
| 809 } | 811 } |
| 810 | 812 |
| 811 public interface SubscriptionAddedCallback | 813 public interface SubscriptionAddedCallback |
| 812 { | 814 { |
| 813 void subscriptionAdded(); | 815 void subscriptionAdded(); |
| 814 } | 816 } |
| 815 } | 817 } |
| LEFT | RIGHT |