| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 catch (PackageManager.NameNotFoundException e) | 183 catch (PackageManager.NameNotFoundException e) |
| 184 { | 184 { |
| 185 // Should never happen, as checkAAStatusAndProceed() should not be called
if the user | 185 // Should never happen, as checkAAStatusAndProceed() should not be called
if the user |
| 186 // has no compatible SBrowser installed. Nevertheless we have to handle th
e Exception. | 186 // has no compatible SBrowser installed. Nevertheless we have to handle th
e Exception. |
| 187 Log.d(TAG, "No compatible Samsung Browser found.", e); | 187 Log.d(TAG, "No compatible Samsung Browser found.", e); |
| 188 return false; | 188 return false; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 public void setSubscriptionUpdateCallback(final SubscriptionUpdateCallback sub
scriptionUpdateCallback) { | 192 public void setSubscriptionUpdateCallback(final SubscriptionUpdateCallback sub
scriptionUpdateCallback) |
| 193 { |
| 193 this.subscriptionUpdateCallback = subscriptionUpdateCallback; | 194 this.subscriptionUpdateCallback = subscriptionUpdateCallback; |
| 194 } | 195 } |
| 195 | 196 |
| 196 public void requestUpdateBroadcast() | 197 public void requestUpdateBroadcast() |
| 197 { | 198 { |
| 198 this.nextUpdateBroadcast = System.currentTimeMillis() + BROADCAST_COMBINATIO
N_DELAY_MILLIS; | 199 this.nextUpdateBroadcast = System.currentTimeMillis() + BROADCAST_COMBINATIO
N_DELAY_MILLIS; |
| 199 } | 200 } |
| 200 | 201 |
| 201 private void writeFileAndSendUpdateBroadcast() | 202 private void writeFileAndSendUpdateBroadcast() |
| 202 { | 203 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 public List<SubscriptionInfo> getListedSubscriptions() | 254 public List<SubscriptionInfo> getListedSubscriptions() |
| 254 { | 255 { |
| 255 return this.subscriptions.getSubscriptions(this); | 256 return this.subscriptions.getSubscriptions(this); |
| 256 } | 257 } |
| 257 | 258 |
| 258 public void changeSubscriptionState(final String id, final boolean enabled) | 259 public void changeSubscriptionState(final String id, final boolean enabled) |
| 259 { | 260 { |
| 260 if (this.subscriptionUpdateCallback != null) | 261 if (this.subscriptionUpdateCallback != null) |
| 261 { | 262 { |
| 262 this.subscriptionUpdateCallback.subscriptionUpdateRequested(); | 263 this.subscriptionUpdateCallback.subscriptionUpdateRequested(enabled); |
| 263 } | 264 } |
| 264 this.engineEvents.add(new ChangeEnabledStateEvent(id, enabled)); | 265 this.engineEvents.add(new ChangeEnabledStateEvent(id, enabled)); |
| 265 } | 266 } |
| 266 | 267 |
| 267 public void subscriptionStateChanged() { | 268 public void subscriptionStateChanged() { |
| 268 if (this.subscriptionUpdateCallback != null) | 269 if (this.subscriptionUpdateCallback != null) |
| 269 { | 270 { |
| 270 this.subscriptionUpdateCallback.subscriptionUpdatedApplied(); | 271 this.subscriptionUpdateCallback.subscriptionUpdatedApplied(); |
| 271 } | 272 } |
| 272 } | 273 } |
| 273 | 274 |
| 274 void downloadFinished(final String id, final int responseCode, final String re
sponse, | 275 void downloadFinished(final String id, final int responseCode, final String re
sponse, |
| 275 final Map<String, String> headers) | 276 final Map<String, String> headers) |
| 276 { | 277 { |
| 277 this.engineEvents.add(new DownloadFinishedEvent(id, responseCode, response,
headers)); | 278 this.engineEvents.add(new DownloadFinishedEvent(id, responseCode, response,
headers)); |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 Log.d(TAG, headers.toString()); | 800 Log.d(TAG, headers.toString()); |
| 800 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); | 801 this.downloader.enqueueDownload(this.createDownloadURL(sub), sub.getId(),
headers); |
| 801 } | 802 } |
| 802 } | 803 } |
| 803 | 804 |
| 804 public void connectivityChanged() | 805 public void connectivityChanged() |
| 805 { | 806 { |
| 806 this.downloader.connectivityChanged(); | 807 this.downloader.connectivityChanged(); |
| 807 } | 808 } |
| 808 | 809 |
| 809 public interface SubscriptionUpdateCallback { | 810 public interface SubscriptionUpdateCallback |
| 810 void subscriptionUpdateRequested(); | 811 { |
| 812 void subscriptionUpdateRequested(boolean enabled); |
| 811 void subscriptionUpdatedApplied(); | 813 void subscriptionUpdatedApplied(); |
| 812 } | 814 } |
| 813 } | 815 } |
| LEFT | RIGHT |