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

Side by Side Diff: mobile/android/thirdparty/org/adblockplus/browser/MoreSubscriptionsPreferenceGroup.java

Issue 29505609: Issue 5469 - Clipped text inside 'More blocking options' setting (Closed)
Patch Set: Created Aug. 4, 2017, 9:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.HashMap; 20 import java.util.HashMap;
21 import java.util.HashSet; 21 import java.util.HashSet;
22 import java.util.Map.Entry; 22 import java.util.Map.Entry;
23 import java.util.concurrent.Semaphore; 23 import java.util.concurrent.Semaphore;
24 24
25 import org.mozilla.gecko.R; 25 import org.mozilla.gecko.R;
26 import org.mozilla.gecko.preferences.CustomCheckBoxPreference;
26 import org.mozilla.gecko.util.NativeJSObject; 27 import org.mozilla.gecko.util.NativeJSObject;
27 import org.mozilla.gecko.util.ThreadUtils; 28 import org.mozilla.gecko.util.ThreadUtils;
28 29
29 import android.app.ProgressDialog; 30 import android.app.ProgressDialog;
30 import android.content.Context; 31 import android.content.Context;
31 import android.os.Build; 32 import android.os.Build;
32 import android.preference.CheckBoxPreference; 33 import android.preference.CheckBoxPreference;
33 import android.preference.Preference; 34 import android.preference.Preference;
34 import android.preference.PreferenceGroup; 35 import android.preference.PreferenceGroup;
35 import android.util.AttributeSet; 36 import android.util.AttributeSet;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 protected View onCreateView(final ViewGroup parent) 108 protected View onCreateView(final ViewGroup parent)
108 { 109 {
109 this.setLayoutResource(R.layout.abb_minimal_widget); 110 this.setLayoutResource(R.layout.abb_minimal_widget);
110 return super.onCreateView(parent); 111 return super.onCreateView(parent);
111 } 112 }
112 113
113 public static Preference createCheckBoxOrSwitch(final Context context) 114 public static Preference createCheckBoxOrSwitch(final Context context)
114 { 115 {
115 if (Build.VERSION.SDK_INT < 14) 116 if (Build.VERSION.SDK_INT < 14)
116 { 117 {
117 return new CheckBoxPreference(context); 118 return new CustomCheckBoxPreference(context);
118 } 119 }
119 try 120 try
120 { 121 {
121 return (Preference) Class.forName("android.preference.SwitchPreference") 122 return (Preference) Class.forName("android.preference.SwitchPreference")
122 .getConstructor(Context.class) 123 .getConstructor(Context.class)
123 .newInstance(context); 124 .newInstance(context);
124 } 125 }
125 catch (Exception e) 126 catch (Exception e)
126 { 127 {
127 Log.e(TAG, "Failed to create SwitchPreference, falling back to CheckBoxPre ference", e); 128 Log.e(TAG, "Failed to create SwitchPreference, falling back to CheckBoxPre ference", e);
128 return new CheckBoxPreference(context); 129 return new CustomCheckBoxPreference(context);
129 } 130 }
130 } 131 }
131 132
132 @Override 133 @Override
133 protected void onAttachedToActivity() 134 protected void onAttachedToActivity()
134 { 135 {
135 this.setEnabled(false); 136 this.setEnabled(false);
136 this.setShouldDisableView(true); 137 this.setShouldDisableView(true);
137 138
138 super.onAttachedToActivity(); 139 super.onAttachedToActivity();
(...skipping 24 matching lines...) Expand all
163 } 164 }
164 }); 165 });
165 } 166 }
166 167
167 private void initEntries() 168 private void initEntries()
168 { 169 {
169 this.removeAll(); 170 this.removeAll();
170 int i = 0; 171 int i = 0;
171 for (; i < BUILTIN_TITLES.length; i++) 172 for (; i < BUILTIN_TITLES.length; i++)
172 { 173 {
173 final CheckBoxPreference cbp = new CheckBoxPreference(this.getContext()); 174 final CheckBoxPreference cbp = new CustomCheckBoxPreference(this.getContex t());
174 final String url = BUILTIN_LISTS[i * 2 + 1]; 175 final String url = BUILTIN_LISTS[i * 2 + 1];
175 cbp.setOrder(i); 176 cbp.setOrder(i);
176 cbp.setTitle(BUILTIN_TITLES[i]); 177 cbp.setTitle(BUILTIN_TITLES[i]);
177 cbp.setKey(url); 178 cbp.setKey(url);
178 cbp.setChecked(this.activeSubscriptions.enabledSubscriptions.containsKey(u rl)); 179 cbp.setChecked(this.activeSubscriptions.enabledSubscriptions.containsKey(u rl));
179 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener); 180 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener);
180 cbp.setPersistent(false); 181 cbp.setPersistent(false);
181 this.addPreference(cbp); 182 this.addPreference(cbp);
182 } 183 }
183 184
184 for (Entry<String, String> e : this.activeSubscriptions.enabledSubscriptions .entrySet()) 185 for (Entry<String, String> e : this.activeSubscriptions.enabledSubscriptions .entrySet())
185 { 186 {
186 if (!BUILTIN_URL_TO_INDEX.containsKey(e.getKey())) 187 if (!BUILTIN_URL_TO_INDEX.containsKey(e.getKey()))
187 { 188 {
188 final CheckBoxPreference cbp = new CheckBoxPreference(this.getContext()) ; 189 final CheckBoxPreference cbp = new CustomCheckBoxPreference(this.getCont ext());
189 cbp.setOrder(i++); 190 cbp.setOrder(i++);
190 cbp.setTitle(e.getValue()); 191 cbp.setTitle(e.getValue());
191 cbp.setKey(e.getKey()); 192 cbp.setKey(e.getKey());
192 cbp.setChecked(true); 193 cbp.setChecked(true);
193 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener); 194 cbp.setOnPreferenceChangeListener(this.checkBoxChangeListener);
194 cbp.setPersistent(false); 195 cbp.setPersistent(false);
195 this.addPreference(cbp); 196 this.addPreference(cbp);
196 } 197 }
197 } 198 }
198 199
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // ignored 349 // ignored
349 } 350 }
350 351
351 @Override 352 @Override
352 public void onApiRequestFailed(String errorMessage) 353 public void onApiRequestFailed(String errorMessage)
353 { 354 {
354 // ignored 355 // ignored
355 } 356 }
356 } 357 }
357 } 358 }
OLDNEW
« no previous file with comments | « no previous file | mobile/android/thirdparty/org/adblockplus/browser/SubscriptionPreferenceCategory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld