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

Unified Diff: mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java

Issue 29322610: Issue 2720 - [Adblocking settings] Add the other filter lists category (Closed)
Patch Set: Changed screen title Created July 20, 2015, 5 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: mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java
diff --git a/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java b/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java
index c23794d3b98db77c2e46e6be7e61ab3dfb8a8ba3..8c81144a7b4e92f796b35f030157f57330e04520 100644
--- a/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java
+++ b/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java
@@ -33,8 +33,6 @@ import org.xmlpull.v1.XmlPullParserException;
import android.app.ProgressDialog;
import android.content.Context;
-import android.os.Handler;
-import android.os.HandlerThread;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
@@ -44,22 +42,11 @@ import android.util.Xml;
public class SubscriptionPreferenceCategory extends PreferenceCategory
{
- private static final HandlerThread HANDLER_THREAD;
- private static final Handler HANDLER;
-
private volatile static SubscriptionContainer subscriptionContainer = null;
private final CheckBoxChangeListener checkBoxChangeListener = new CheckBoxChangeListener();
private boolean isEnabledList = false;
private ProgressDialog progressDialog;
- static
- {
- HANDLER_THREAD = new HandlerThread("subscription-preference-background");
- HANDLER_THREAD.setDaemon(true);
- HANDLER_THREAD.start();
- HANDLER = new Handler(HANDLER_THREAD.getLooper());
- }
-
public SubscriptionPreferenceCategory(Context context)
{
super(context);
@@ -103,7 +90,7 @@ public class SubscriptionPreferenceCategory extends PreferenceCategory
this.progressDialog.setMessage(this.getContext().getString(R.string.abb_adblocking_waiting));
this.progressDialog.show();
- HANDLER.post(new Runnable()
+ AddOnBridge.handlerPost(new Runnable()
{
@Override
public void run()
@@ -201,7 +188,7 @@ public class SubscriptionPreferenceCategory extends PreferenceCategory
}
}
- private final static class SubscriptionContainer implements AdblockPlusApiCallback
+ final static class SubscriptionContainer implements AdblockPlusApiCallback
{
private static final String TAG = SubscriptionContainer.class.getName();
private final ConcurrentHashMap<String, Boolean> enableState = new ConcurrentHashMap<String, Boolean>();
@@ -216,6 +203,11 @@ public class SubscriptionPreferenceCategory extends PreferenceCategory
public final static SubscriptionContainer create()
{
+ return create(true);
+ }
+
+ public final static SubscriptionContainer create(final boolean refresh)
+ {
final SubscriptionContainer sc = new SubscriptionContainer();
AddOnBridge.queryValue(sc, "subscriptionsXml");
sc.entriesReady.acquireUninterruptibly();
@@ -226,7 +218,10 @@ public class SubscriptionPreferenceCategory extends PreferenceCategory
sc.enableState.put(e.url, Boolean.FALSE);
}
- sc.refresh();
+ if (refresh)
+ {
+ sc.refresh();
+ }
return sc;
}

Powered by Google App Engine
This is Rietveld