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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 private void refreshValue() | 56 private void refreshValue() |
57 { | 57 { |
58 AddOnBridge.queryValue(this, this.apiKey); | 58 AddOnBridge.queryValue(this, this.apiKey); |
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, this.apiKey, this.isChecked()); | 65 AddOnBridge.setBoolean(this, this.apiKey, this.isChecked()); |
66 this.refreshValue(); | |
67 } | 66 } |
68 | 67 |
69 @Override | 68 @Override |
70 public void onApiRequestSucceeded(NativeJSObject jsObject) | 69 public void onApiRequestSucceeded(NativeJSObject jsObject) |
71 { | 70 { |
72 if (jsObject.has("value")) | 71 if (jsObject.has("value")) |
73 { | 72 { |
74 final boolean enabled = AddOnBridge.getBooleanFromJsObject(jsObject, "valu
e", false); | 73 final boolean enabled = AddOnBridge.getBooleanFromJsObject(jsObject, "valu
e", false); |
75 | 74 |
76 ThreadUtils.postToUiThread(new Runnable() | 75 ThreadUtils.postToUiThread(new Runnable() |
77 { | 76 { |
78 @Override | 77 @Override |
79 public void run() | 78 public void run() |
80 { | 79 { |
81 AbpCheckBoxPreference.this.setChecked(enabled); | 80 AbpCheckBoxPreference.this.setChecked(enabled); |
82 AbpCheckBoxPreference.this.setEnabled(true); | 81 AbpCheckBoxPreference.this.setEnabled(true); |
83 } | 82 } |
84 }); | 83 }); |
85 } | 84 } |
86 } | 85 } |
87 | 86 |
88 @Override | 87 @Override |
89 public void onApiRequestFailed(String errorMessage) | 88 public void onApiRequestFailed(String errorMessage) |
90 { | 89 { |
91 // Currently ignored | 90 // Currently ignored |
92 } | 91 } |
93 } | 92 } |
OLD | NEW |