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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 package org.adblockplus.browser; | 18 package org.adblockplus.browser; |
19 | 19 |
20 import java.util.List; | 20 import java.util.List; |
21 | 21 |
22 import org.mozilla.gecko.R; | 22 import org.mozilla.gecko.R; |
| 23 import org.mozilla.gecko.preferences.CustomCheckBoxPreference; |
23 import org.mozilla.gecko.util.ThreadUtils; | 24 import org.mozilla.gecko.util.ThreadUtils; |
24 | 25 |
25 import android.app.ProgressDialog; | 26 import android.app.ProgressDialog; |
26 import android.content.Context; | 27 import android.content.Context; |
27 import android.preference.CheckBoxPreference; | 28 import android.preference.CheckBoxPreference; |
28 import android.preference.Preference; | 29 import android.preference.Preference; |
29 import android.preference.PreferenceCategory; | 30 import android.preference.PreferenceCategory; |
30 import android.util.AttributeSet; | 31 import android.util.AttributeSet; |
31 | 32 |
32 public class SubscriptionPreferenceCategory extends PreferenceCategory | 33 public class SubscriptionPreferenceCategory extends PreferenceCategory |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 preference.setSummary(summaryId); | 105 preference.setSummary(summaryId); |
105 preference.setEnabled(false); | 106 preference.setEnabled(false); |
106 preference.setShouldDisableView(true); | 107 preference.setShouldDisableView(true); |
107 preference.setSelectable(false); | 108 preference.setSelectable(false); |
108 return preference; | 109 return preference; |
109 } | 110 } |
110 | 111 |
111 private CheckBoxPreference createEnabledCheckBox( | 112 private CheckBoxPreference createEnabledCheckBox( |
112 final SubscriptionContainer.Subscription subscription) | 113 final SubscriptionContainer.Subscription subscription) |
113 { | 114 { |
114 final CheckBoxPreference cbp = new CheckBoxPreference(this.getContext()); | 115 final CheckBoxPreference cbp = new CustomCheckBoxPreference(this.getContext(
)); |
115 cbp.setTitle(subscription.specialization); | 116 cbp.setTitle(subscription.specialization); |
116 cbp.setSummary(subscription.title); | 117 cbp.setSummary(subscription.title); |
117 cbp.setChecked(true); | 118 cbp.setChecked(true); |
118 cbp.setKey(subscription.url); | 119 cbp.setKey(subscription.url); |
119 cbp.setPersistent(false); | 120 cbp.setPersistent(false); |
120 cbp.setChecked(subscriptionContainer.isSubscriptionListed(subscription.url))
; | 121 cbp.setChecked(subscriptionContainer.isSubscriptionListed(subscription.url))
; |
121 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener); | 122 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener); |
122 return cbp; | 123 return cbp; |
123 } | 124 } |
124 | 125 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 private class SubscriptionChangeListener implements SubscriptionContainer.Subs
criptionListener | 200 private class SubscriptionChangeListener implements SubscriptionContainer.Subs
criptionListener |
200 { | 201 { |
201 @Override | 202 @Override |
202 public void onSubscriptionUpdated() | 203 public void onSubscriptionUpdated() |
203 { | 204 { |
204 SubscriptionPreferenceCategory.this.refreshEntries(); | 205 SubscriptionPreferenceCategory.this.refreshEntries(); |
205 } | 206 } |
206 } | 207 } |
207 } | 208 } |
208 | 209 |
OLD | NEW |