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

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

Issue 29588596: Issue 5919 - Adjust our code to the new messaging system (Closed)
Patch Set: Removing Log statement Created Oct. 25, 2017, 11:43 a.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/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
}
}

Powered by Google App Engine
This is Rietveld