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.PreferenceActi |
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 @@ public class MainPreferences extends Pre |
} |
} |
@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,22 @@ public class MainPreferences extends Pre |
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 ? |
anton
2017/06/26 14:45:54
would it not be better to have it like this ".. en
|
+ getString(R.string.add_subscription_dialog_message) : getString(R.string.remove_subscription_dialog_message)); |
+ } |
+ |
+ @Override |
+ public void subscriptionUpdatedApplied() |
+ { |
+ this.dismissDialog(); |
+ } |
} |