Index: mobile/android/thirdparty/org/adblockplus/browser/AbpCheckBoxPreference.java |
=================================================================== |
--- a/mobile/android/thirdparty/org/adblockplus/browser/AbpCheckBoxPreference.java |
+++ b/mobile/android/thirdparty/org/adblockplus/browser/AbpCheckBoxPreference.java |
@@ -13,17 +13,17 @@ |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
package org.adblockplus.browser; |
import org.mozilla.gecko.preferences.CustomCheckBoxPreference; |
-import org.mozilla.gecko.util.NativeJSObject; |
+import org.mozilla.gecko.util.GeckoBundle; |
import org.mozilla.gecko.util.ThreadUtils; |
import android.content.Context; |
import android.util.AttributeSet; |
public class AbpCheckBoxPreference extends CustomCheckBoxPreference implements |
AdblockPlusApiCallback |
{ |
@@ -50,43 +50,39 @@ public class AbpCheckBoxPreference exten |
super.onAttachedToActivity(); |
this.apiKey = this.getKey().substring(this.getKey().lastIndexOf(".api") + 4); |
this.setEnabled(false); |
this.refreshValue(); |
} |
private void refreshValue() |
{ |
- AddOnBridge.queryValue(this, this.apiKey); |
+ AddOnBridge.queryValue(this.apiKey, this); |
} |
@Override |
protected void onClick() |
{ |
super.onClick(); |
- AddOnBridge.setBoolean(this, this.apiKey, this.isChecked()); |
+ AddOnBridge.setBoolean(this.apiKey, this.isChecked(), null); |
} |
@Override |
- public void onApiRequestSucceeded(NativeJSObject jsObject) |
+ public void onApiRequestSucceeded(GeckoBundle bundle) |
{ |
- if (jsObject.has("value")) |
+ final boolean enabled = bundle.getBoolean("value"); |
+ ThreadUtils.postToUiThread(new Runnable() |
{ |
- final boolean enabled = AddOnBridge.getBooleanFromJsObject(jsObject, "value", false); |
- |
- ThreadUtils.postToUiThread(new Runnable() |
+ @Override |
+ public void run() |
{ |
- @Override |
- public void run() |
- { |
- AbpCheckBoxPreference.this.setChecked(enabled); |
- AbpCheckBoxPreference.this.setEnabled(true); |
- } |
- }); |
- } |
+ AbpCheckBoxPreference.this.setChecked(enabled); |
+ AbpCheckBoxPreference.this.setEnabled(true); |
+ } |
+ }); |
} |
@Override |
public void onApiRequestFailed(String errorMessage) |
{ |
// Currently ignored |
} |
} |