| 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(); |
| + } |
| + } |
| } |