| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 import android.content.Context; | 49 import android.content.Context; |
| 50 import android.content.Intent; | 50 import android.content.Intent; |
| 51 import android.content.pm.PackageInfo; | 51 import android.content.pm.PackageInfo; |
| 52 import android.content.pm.PackageManager; | 52 import android.content.pm.PackageManager; |
| 53 import android.content.pm.ResolveInfo; | 53 import android.content.pm.ResolveInfo; |
| 54 import android.net.ConnectivityManager; | 54 import android.net.ConnectivityManager; |
| 55 import android.net.NetworkInfo; | 55 import android.net.NetworkInfo; |
| 56 import android.net.Uri; | 56 import android.net.Uri; |
| 57 import android.os.Handler; | 57 import android.os.Handler; |
| 58 import android.os.Looper; | 58 import android.os.Looper; |
| 59 import android.support.annotation.VisibleForTesting; | |
| 60 import android.text.TextUtils; | 59 import android.text.TextUtils; |
| 61 import android.text.format.DateUtils; | 60 import android.text.format.DateUtils; |
| 62 import android.util.Log; | 61 import android.util.Log; |
| 63 | 62 |
| 64 public final class Engine | 63 public final class Engine |
| 65 { | 64 { |
| 66 private static final String TAG = Engine.class.getSimpleName(); | 65 private static final String TAG = Engine.class.getSimpleName(); |
| 67 | 66 |
| 68 public static final String USER_FILTERS_TITLE = "__filters"; | 67 public static final String USER_FILTERS_TITLE = "__filters"; |
| 69 public static final String USER_EXCEPTIONS_TITLE = "__exceptions"; | 68 public static final String USER_EXCEPTIONS_TITLE = "__exceptions"; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 return this.defaultSubscriptions.getForUrl(url); | 339 return this.defaultSubscriptions.getForUrl(url); |
| 341 } | 340 } |
| 342 | 341 |
| 343 /** | 342 /** |
| 344 * If the user starts the app for the first time, we force to update the subsc
ription which was | 343 * If the user starts the app for the first time, we force to update the subsc
ription which was |
| 345 * selected as the default, no matter if he has a WIFI connection or not. From
the second start | 344 * selected as the default, no matter if he has a WIFI connection or not. From
the second start |
| 346 * we only update when the user has a WIFI connection. | 345 * we only update when the user has a WIFI connection. |
| 347 * | 346 * |
| 348 * @return a boolean that indicated if this is the first start of the app | 347 * @return a boolean that indicated if this is the first start of the app |
| 349 */ | 348 */ |
| 350 @VisibleForTesting | |
| 351 private boolean wasFirstRun() | 349 private boolean wasFirstRun() |
| 352 { | 350 { |
| 353 if (wasFirstRun) | 351 if (wasFirstRun) |
| 354 { | 352 { |
| 355 this.wasFirstRun = false; | 353 this.wasFirstRun = false; |
| 356 return true; | 354 return true; |
| 357 } | 355 } |
| 358 else | 356 else |
| 359 { | 357 { |
| 360 return false; | 358 return false; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 { | 808 { |
| 811 void subscriptionUpdateRequested(boolean enabled); | 809 void subscriptionUpdateRequested(boolean enabled); |
| 812 void subscriptionUpdatedApplied(); | 810 void subscriptionUpdatedApplied(); |
| 813 } | 811 } |
| 814 | 812 |
| 815 public interface SubscriptionAddedCallback | 813 public interface SubscriptionAddedCallback |
| 816 { | 814 { |
| 817 void subscriptionAdded(); | 815 void subscriptionAdded(); |
| 818 } | 816 } |
| 819 } | 817 } |
| LEFT | RIGHT |