| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 import android.net.Uri; | 43 import android.net.Uri; |
| 44 import android.os.Build; | 44 import android.os.Build; |
| 45 import android.preference.PreferenceManager; | 45 import android.preference.PreferenceManager; |
| 46 import android.provider.Settings; | 46 import android.provider.Settings; |
| 47 import android.util.Log; | 47 import android.util.Log; |
| 48 | 48 |
| 49 public class AdblockPlus extends Application | 49 public class AdblockPlus extends Application |
| 50 { | 50 { |
| 51 public static final int ONGOING_NOTIFICATION_ID = R.string.app_name; | 51 public static final int ONGOING_NOTIFICATION_ID = R.string.app_name; |
| 52 public static final int UPDATE_NOTIFICATION_ID = R.string.app_name + 1; | 52 public static final int UPDATE_NOTIFICATION_ID = R.string.app_name + 1; |
| 53 // Insert new NOTIFICATION_IDs in between here | 53 public static final int SERVER_NOTIFICATION_ID = R.string.app_name + 2; |
| 54 public static final int GROUPED_NOTIFICATION_ID = R.string.app_name + 32; | |
| 55 // Do not add NOTIFICATION_IDs here | |
| 56 | 54 |
| 57 private static final String TAG = Utils.getTag(AdblockPlus.class); | 55 private static final String TAG = Utils.getTag(AdblockPlus.class); |
| 58 | 56 |
| 59 private static final Pattern RE_JS = Pattern.compile("\\.js$", Pattern.CASE_IN
SENSITIVE); | 57 private static final Pattern RE_JS = Pattern.compile("\\.js$", Pattern.CASE_IN
SENSITIVE); |
| 60 private static final Pattern RE_CSS = Pattern.compile("\\.css$", Pattern.CASE_
INSENSITIVE); | 58 private static final Pattern RE_CSS = Pattern.compile("\\.css$", Pattern.CASE_
INSENSITIVE); |
| 61 private static final Pattern RE_IMAGE = Pattern.compile("\\.(?:gif|png|jpe?g|b
mp|ico)$", Pattern.CASE_INSENSITIVE); | 59 private static final Pattern RE_IMAGE = Pattern.compile("\\.(?:gif|png|jpe?g|b
mp|ico)$", Pattern.CASE_INSENSITIVE); |
| 62 private static final Pattern RE_FONT = Pattern.compile("\\.(?:ttf|woff)$", Pat
tern.CASE_INSENSITIVE); | 60 private static final Pattern RE_FONT = Pattern.compile("\\.(?:ttf|woff)$", Pat
tern.CASE_INSENSITIVE); |
| 63 private static final Pattern RE_HTML = Pattern.compile("\\.html?$", Pattern.CA
SE_INSENSITIVE); | 61 private static final Pattern RE_HTML = Pattern.compile("\\.html?$", Pattern.CA
SE_INSENSITIVE); |
| 64 | 62 |
| 65 /** | 63 /** |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 abpEngine.dispose(); | 388 abpEngine.dispose(); |
| 391 abpEngine = null; | 389 abpEngine = null; |
| 392 Log.i(TAG, "stopEngine"); | 390 Log.i(TAG, "stopEngine"); |
| 393 } | 391 } |
| 394 } | 392 } |
| 395 | 393 |
| 396 /** | 394 /** |
| 397 * @return Notification to show for the given URL, {@code null} if none | 395 * @return Notification to show for the given URL, {@code null} if none |
| 398 * available | 396 * available |
| 399 */ | 397 */ |
| 400 public Notification getNotificationToShow(String url) | 398 public Notification getNextNotificationToShow(String url) |
| 401 { | 399 { |
| 402 return this.abpEngine.getNextNotificationToShow(url); | 400 return this.abpEngine.getNextNotificationToShow(url); |
| 403 } | 401 } |
| 404 | 402 |
| 405 /** | 403 /** |
| 406 * @return Notification to show, {@code null} if none available | 404 * @return Notification to show, {@code null} if none available |
| 407 */ | 405 */ |
| 408 public Notification getNotificationToShow() | 406 public Notification getNextNotificationToShow() |
| 409 { | 407 { |
| 410 return this.abpEngine.getNextNotificationToShow(); | 408 return this.abpEngine.getNextNotificationToShow(); |
| 411 } | 409 } |
| 412 | 410 |
| 413 /** | 411 /** |
| 414 * Initiates immediate interactive check for available update. | 412 * Initiates immediate interactive check for available update. |
| 415 */ | 413 */ |
| 416 public void checkUpdates() | 414 public void checkUpdates() |
| 417 { | 415 { |
| 418 abpEngine.checkForUpdates(); | 416 abpEngine.checkForUpdates(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 451 } |
| 454 catch (final IOException e) | 452 catch (final IOException e) |
| 455 { | 453 { |
| 456 Log.e(TAG, e.getMessage(), e); | 454 Log.e(TAG, e.getMessage(), e); |
| 457 } | 455 } |
| 458 | 456 |
| 459 // Set crash handler | 457 // Set crash handler |
| 460 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); | 458 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); |
| 461 } | 459 } |
| 462 } | 460 } |
| LEFT | RIGHT |