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

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

Issue 4705284891082752: Proxy configurators (Closed)
Patch Set: FIXME removed Created Aug. 19, 2014, 12:58 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/BridgeCommand.java
diff --git a/src/org/adblockplus/android/AndroidFilterChangeCallback.java b/src/org/adblockplus/android/BridgeCommand.java
similarity index 51%
copy from src/org/adblockplus/android/AndroidFilterChangeCallback.java
copy to src/org/adblockplus/android/BridgeCommand.java
index f07836c5b4162160706fc92ea7c96df54e8235ab..62be955cadf1b8006ec5e6c2f24b46f36dec5bd9 100644
--- a/src/org/adblockplus/android/AndroidFilterChangeCallback.java
+++ b/src/org/adblockplus/android/BridgeCommand.java
@@ -17,29 +17,35 @@
package org.adblockplus.android;
-import org.adblockplus.libadblockplus.FilterChangeCallback;
-import org.adblockplus.libadblockplus.JsValue;
-import org.adblockplus.libadblockplus.Subscription;
+import java.util.HashMap;
+import java.util.Locale;
-import android.content.Context;
-
-public class AndroidFilterChangeCallback extends FilterChangeCallback
+public enum BridgeCommand
{
- private final Context context;
+ /** Used for e.g. no-traffic check, rebuilds/redisplays notification. */
+ STATE_CHANGED,
+ UNKNOWN;
- public AndroidFilterChangeCallback(final Context context)
- {
- this.context = context;
- }
+ private static final HashMap<String, BridgeCommand> MAP = new HashMap<String, BridgeCommand>();
- @Override
- public void filterChangeCallback(final String action, final JsValue jsValue)
+ static
{
- if (action.equals("subscription.lastDownload") || action.equals("subscription.downloadStatus"))
+ final Locale locale = Locale.ENGLISH;
+ for (final BridgeCommand e : BridgeCommand.values())
{
- final Subscription sub = new Subscription(jsValue);
-
- Utils.updateSubscriptionStatus(this.context, sub);
+ if (e != UNKNOWN)
+ {
+ final String name = e.toString();
+ MAP.put(name, e);
+ MAP.put(name.toLowerCase(locale), e);
+ MAP.put(name.toUpperCase(locale), e);
+ }
}
}
+
+ public static BridgeCommand fromString(final String str)
+ {
+ final BridgeCommand e = MAP.get(str);
+ return e != null ? e : UNKNOWN;
+ }
}
« no previous file with comments | « src/org/adblockplus/android/AdvancedPreferences.java ('k') | src/org/adblockplus/android/ConfigurationActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld