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

Unified Diff: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java

Issue 29445587: Issue 5223 - App is freezing sometimes (Closed)
Patch Set: Added separate texts for adding/removing a subscription Created June 14, 2017, 3:19 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: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
===================================================================
--- a/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
+++ b/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/MainPreferences.java
@@ -33,17 +33,18 @@
import android.preference.PreferenceManager;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.widget.Button;
import android.widget.LinearLayout;
public class MainPreferences extends PreferenceActivity implements
- EngineService.OnEngineCreatedCallback, SharedPreferences.OnSharedPreferenceChangeListener
+ EngineService.OnEngineCreatedCallback, SharedPreferences.OnSharedPreferenceChangeListener,
+ Engine.SubscriptionUpdateCallback
{
private static final String TAG = MainPreferences.class.getSimpleName();
private Engine engine = null;
private AlertDialog dialog;
private int dialogTitleResId;
private SharedPreferences getSharedPreferences()
{
@@ -208,16 +209,22 @@
}
}
@Override
public void onEngineCreated(Engine engine, boolean success)
{
Log.d(TAG, "onEngineCreated: " + success);
this.engine = success ? engine : null;
+
+ if (this.engine != null)
+ {
+ this.engine.setSubscriptionUpdateCallback(this);
+ }
+
if (this.dialogTitleResId == R.string.initialization_title)
{
this.dismissDialog();
this.checkForCompatibleSBrowserAndProceed();
}
}
@@ -238,9 +245,25 @@
else if (this.getString(R.string.key_application_activated).equals(key))
{
if (this.dialogTitleResId == R.string.setup_dialog_title)
{
this.dismissDialog();
}
}
}
+
+ @Override
+ public void subscriptionUpdateRequested(final boolean enabled)
+ {
+ this.dialog = ProgressDialog.show(this, null, enabled ?
+ getString(R.string.add_subscription_dialog_message) : getString(R.string.remove_subscription_dialog_message));
+ }
+
+ @Override
+ public void subscriptionUpdatedApplied()
+ {
+ if (dialog != null)
+ {
+ dialog.dismiss();
+ }
+ }
}

Powered by Google App Engine
This is Rietveld