LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 package org.adblockplus.android; | 18 package org.adblockplus.android; |
19 | 19 |
20 import android.content.BroadcastReceiver; | 20 import android.content.BroadcastReceiver; |
21 import android.content.Context; | 21 import android.content.Context; |
22 import android.content.Intent; | 22 import android.content.Intent; |
23 import android.content.SharedPreferences; | 23 import android.content.SharedPreferences; |
24 import android.preference.PreferenceManager; | 24 import android.preference.PreferenceManager; |
25 | 25 |
26 public class Starter extends BroadcastReceiver | 26 public class Starter extends BroadcastReceiver |
27 { | 27 { |
| 28 |
28 @Override | 29 @Override |
29 public void onReceive(final Context context, final Intent intent) | 30 public void onReceive(final Context context, final Intent intent) |
30 { | 31 { |
31 final String action = intent.getAction(); | 32 final String action = intent.getAction(); |
32 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreference
s(context); | 33 final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreference
s(context); |
33 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled),
false); | 34 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled),
false); |
34 boolean proxyenabled = prefs.getBoolean(context.getString(R.string.pref_prox
yenabled), true); | 35 boolean proxyenabled = prefs.getBoolean(context.getString(R.string.pref_prox
yenabled), true); |
35 final boolean autoconfigured = prefs.getBoolean(context.getString(R.string.p
ref_proxyautoconfigured), false); | 36 final boolean autoconfigured = prefs.getBoolean(context.getString(R.string.p
ref_proxyautoconfigured), false); |
36 if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) | 37 if (Intent.ACTION_PACKAGE_REPLACED.equals(action)) |
37 { | 38 { |
(...skipping 10 matching lines...) Expand all Loading... |
48 } | 49 } |
49 if (enabled) | 50 if (enabled) |
50 { | 51 { |
51 final AdblockPlus application = AdblockPlus.getApplication(); | 52 final AdblockPlus application = AdblockPlus.getApplication(); |
52 application.setFilteringEnabled(true); | 53 application.setFilteringEnabled(true); |
53 application.startEngine(); | 54 application.startEngine(); |
54 } | 55 } |
55 if (enabled || (proxyenabled && !autoconfigured)) | 56 if (enabled || (proxyenabled && !autoconfigured)) |
56 context.startService(new Intent(context, ProxyService.class)); | 57 context.startService(new Intent(context, ProxyService.class)); |
57 } | 58 } |
| 59 |
58 } | 60 } |
LEFT | RIGHT |