OLD | NEW |
(Empty) | |
| 1 package org.adblockplus.android; |
| 2 |
| 3 import android.content.BroadcastReceiver; |
| 4 import android.content.Context; |
| 5 import android.content.Intent; |
| 6 import android.content.SharedPreferences; |
| 7 import android.preference.PreferenceManager; |
| 8 |
| 9 public class Starter extends BroadcastReceiver |
| 10 { |
| 11 |
| 12 @Override |
| 13 public void onReceive(Context context, Intent intent) |
| 14 { |
| 15 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(cont
ext); |
| 16 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled),
false); |
| 17 if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) |
| 18 { |
| 19 enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpec
ificPart()); |
| 20 } |
| 21 if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) |
| 22 { |
| 23 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta
rtatboot), context.getResources().getBoolean(R.bool.def_startatboot)); |
| 24 enabled &= startAtBoot; |
| 25 } |
| 26 if (enabled) |
| 27 context.startService(new Intent(context, ProxyService.class)); |
| 28 } |
| 29 |
| 30 } |
OLD | NEW |