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

Unified Diff: src/org/adblockplus/android/Starter.java

Issue 9437197: ABP/Android Proxy switch (Closed)
Patch Set: Created Feb. 28, 2013, 1:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/android/Starter.java
===================================================================
--- a/src/org/adblockplus/android/Starter.java
+++ b/src/org/adblockplus/android/Starter.java
@@ -32,16 +32,26 @@
String action = intent.getAction();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean(context.getString(R.string.pref_enabled), false);
+ boolean proxyenabled = prefs.getBoolean(context.getString(R.string.pref_proxyenabled), false);
if (Intent.ACTION_PACKAGE_REPLACED.equals(action))
{
- enabled &= "org.adblockplus.android".equals(intent.getData().getSchemeSpecificPart());
+ boolean us = "org.adblockplus.android".equals(intent.getData().getSchemeSpecificPart());
Felix Dahlke 2013/03/11 06:57:38 Any idea how we could not hard code the package he
Andrey Novikov 2013/03/11 07:32:55 Done.
Andrey Novikov 2013/03/11 07:32:55 Done.
+ enabled &= us;
+ proxyenabled &= us;
}
if (Intent.ACTION_BOOT_COMPLETED.equals(action))
{
boolean startAtBoot = prefs.getBoolean(context.getString(R.string.pref_startatboot), context.getResources().getBoolean(R.bool.def_startatboot));
enabled &= startAtBoot;
+ proxyenabled &= startAtBoot;
}
if (enabled)
+ {
+ AdblockPlus application = AdblockPlus.getApplication();
+ application.setFilteringEnabled(true);
+ application.startEngine();
+ }
+ if (proxyenabled)
context.startService(new Intent(context, ProxyService.class));
}

Powered by Google App Engine
This is Rietveld