Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/org/adblockplus/android/Starter.java

Issue 8837074: ABP/Android Post-update starter (Closed)
Left Patch Set: Created Nov. 15, 2012, 11:20 a.m.
Right Patch Set: ABP/Android Post-update starter Created Nov. 15, 2012, 11:31 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « AndroidManifest.xml ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 package org.adblockplus.android; 1 package org.adblockplus.android;
2 2
3 import android.content.BroadcastReceiver; 3 import android.content.BroadcastReceiver;
4 import android.content.Context; 4 import android.content.Context;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.content.SharedPreferences; 6 import android.content.SharedPreferences;
7 import android.preference.PreferenceManager; 7 import android.preference.PreferenceManager;
8 8
9 public class Starter extends BroadcastReceiver 9 public class Starter extends BroadcastReceiver
10 { 10 {
11 11
12 @Override 12 @Override
13 public void onReceive(Context context, Intent intent) 13 public void onReceive(Context context, Intent intent)
14 { 14 {
15 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(cont ext); 15 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(cont ext);
16 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false); 16 boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false);
17 if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) 17 if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction()))
Felix Dahlke 2012/11/16 13:54:18 intent.getAction() is used twice, I'd assign it to
Andrey Novikov 2012/11/16 13:56:08 Yes, I wanted to, but forgot. :) Fixed.
18 { 18 {
19 enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpec ificPart()); 19 enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpec ificPart());
20 } 20 }
21 if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) 21 if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
22 { 22 {
23 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot)); 23 boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_sta rtatboot), context.getResources().getBoolean(R.bool.def_startatboot));
24 enabled &= startAtBoot; 24 enabled &= startAtBoot;
25 } 25 }
26 if (enabled) 26 if (enabled)
27 context.startService(new Intent(context, ProxyService.class)); 27 context.startService(new Intent(context, ProxyService.class));
28 } 28 }
29 29
30 } 30 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld