| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 protected void onAttachedToActivity() | 48 protected void onAttachedToActivity() |
| 49 { | 49 { |
| 50 super.onAttachedToActivity(); | 50 super.onAttachedToActivity(); |
| 51 this.apiKey = this.getKey().substring(this.getKey().lastIndexOf(".api") + 4)
; | 51 this.apiKey = this.getKey().substring(this.getKey().lastIndexOf(".api") + 4)
; |
| 52 this.setEnabled(false); | 52 this.setEnabled(false); |
| 53 this.refreshValue(); | 53 this.refreshValue(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private void refreshValue() | 56 private void refreshValue() |
| 57 { | 57 { |
| 58 AddOnBridge.queryValue(this.apiKey, this); | 58 ExtensionBridge.queryValue(this.apiKey, this); |
| 59 } | 59 } |
| 60 | 60 |
| 61 @Override | 61 @Override |
| 62 protected void onClick() | 62 protected void onClick() |
| 63 { | 63 { |
| 64 super.onClick(); | 64 super.onClick(); |
| 65 AddOnBridge.setBoolean(this.apiKey, this.isChecked(), null); | 65 ExtensionBridge.setBoolean(this.apiKey, this.isChecked(), null); |
| 66 } | 66 } |
| 67 | 67 |
| 68 @Override | 68 @Override |
| 69 public void onApiRequestSucceeded(GeckoBundle bundle) | 69 public void onApiRequestSucceeded(GeckoBundle bundle) |
| 70 { | 70 { |
| 71 final boolean enabled = bundle.getBoolean("value"); | 71 final boolean enabled = bundle.getBoolean("value"); |
| 72 ThreadUtils.postToUiThread(new Runnable() | 72 ThreadUtils.postToUiThread(new Runnable() |
| 73 { | 73 { |
| 74 @Override | 74 @Override |
| 75 public void run() | 75 public void run() |
| 76 { | 76 { |
| 77 AbpCheckBoxPreference.this.setChecked(enabled); | 77 AbpCheckBoxPreference.this.setChecked(enabled); |
| 78 AbpCheckBoxPreference.this.setEnabled(true); | 78 AbpCheckBoxPreference.this.setEnabled(true); |
| 79 } | 79 } |
| 80 }); | 80 }); |
| 81 } | 81 } |
| 82 | 82 |
| 83 @Override | 83 @Override |
| 84 public void onApiRequestFailed(String errorMessage) | 84 public void onApiRequestFailed(String errorMessage) |
| 85 { | 85 { |
| 86 // Currently ignored | 86 // Currently ignored |
| 87 } | 87 } |
| 88 } | 88 } |
| OLD | NEW |