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 16 matching lines...) Expand all Loading... |
27 import org.adblockplus.sbrowser.contentblocker.engine.SubscriptionInfo; | 27 import org.adblockplus.sbrowser.contentblocker.engine.SubscriptionInfo; |
28 import org.adblockplus.adblockplussbrowser.R; | 28 import org.adblockplus.adblockplussbrowser.R; |
29 | 29 |
30 import android.content.Context; | 30 import android.content.Context; |
31 import android.preference.CheckBoxPreference; | 31 import android.preference.CheckBoxPreference; |
32 import android.preference.Preference; | 32 import android.preference.Preference; |
33 import android.preference.PreferenceCategory; | 33 import android.preference.PreferenceCategory; |
34 import android.preference.Preference.OnPreferenceChangeListener; | 34 import android.preference.Preference.OnPreferenceChangeListener; |
35 import android.text.format.DateUtils; | 35 import android.text.format.DateUtils; |
36 import android.util.AttributeSet; | 36 import android.util.AttributeSet; |
37 import android.view.View; | |
38 import android.view.ViewGroup; | |
39 | 37 |
40 public class MoreBlockingPreferenceCategory extends PreferenceCategory implement
s | 38 public class MoreBlockingPreferenceCategory extends PreferenceCategory implement
s |
41 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener | 39 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener |
42 { | 40 { |
43 private Engine engine = null; | 41 private Engine engine = null; |
44 private static final int[] WHITELISTED_LIST_TITLES = | 42 private static final int[] WHITELISTED_LIST_TITLES = |
45 { | 43 { |
46 R.string.subscription_disable_tracking, | 44 R.string.subscription_disable_tracking, |
47 R.string.subscription_disable_malware, | 45 R.string.subscription_disable_malware, |
48 R.string.subscription_disable_anti_adblock, | 46 R.string.subscription_disable_anti_adblock, |
(...skipping 22 matching lines...) Expand all Loading... |
71 { | 69 { |
72 super(context); | 70 super(context); |
73 } | 71 } |
74 | 72 |
75 public MoreBlockingPreferenceCategory(final Context context, final AttributeSe
t attrs) | 73 public MoreBlockingPreferenceCategory(final Context context, final AttributeSe
t attrs) |
76 { | 74 { |
77 super(context, attrs); | 75 super(context, attrs); |
78 } | 76 } |
79 | 77 |
80 @Override | 78 @Override |
81 protected View onCreateView(final ViewGroup parent) | |
82 { | |
83 return super.onCreateView(parent); | |
84 } | |
85 | |
86 @Override | |
87 protected void onAttachedToActivity() | 79 protected void onAttachedToActivity() |
88 { | 80 { |
89 EngineService.startService(this.getContext().getApplicationContext(), this); | 81 EngineService.startService(this.getContext().getApplicationContext(), this); |
90 super.onAttachedToActivity(); | 82 super.onAttachedToActivity(); |
91 } | 83 } |
92 | 84 |
93 @Override | 85 @Override |
94 public void onEngineCreated(final Engine engine, final boolean success) | 86 public void onEngineCreated(final Engine engine, final boolean success) |
95 { | 87 { |
96 this.engine = engine; | 88 this.engine = engine; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 public boolean onPreferenceChange(final Preference preference, final Object ne
wValue) | 139 public boolean onPreferenceChange(final Preference preference, final Object ne
wValue) |
148 { | 140 { |
149 final String id = preference.getKey(); | 141 final String id = preference.getKey(); |
150 final boolean enabled = ((Boolean) newValue).booleanValue(); | 142 final boolean enabled = ((Boolean) newValue).booleanValue(); |
151 | 143 |
152 this.engine.changeSubscriptionState(id, enabled); | 144 this.engine.changeSubscriptionState(id, enabled); |
153 | 145 |
154 return true; | 146 return true; |
155 } | 147 } |
156 } | 148 } |
OLD | NEW |