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

Side by Side Diff: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/MoreBlockingPreferenceCategory.java

Issue 29441558: Issue 5243 - Clipped text across languages (Closed)
Patch Set: Fixed layout name and bracket in preferences_main.xml Created May 31, 2017, 1:58 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
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.sbrowser.contentblocker; 18 package org.adblockplus.sbrowser.contentblocker;
19 19
20 import java.util.Collections; 20 import java.util.Collections;
21 import java.util.HashMap; 21 import java.util.HashMap;
22 import java.util.List; 22 import java.util.List;
23 23
24 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo; 24 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo;
25 import org.adblockplus.sbrowser.contentblocker.engine.Engine; 25 import org.adblockplus.sbrowser.contentblocker.engine.Engine;
26 import org.adblockplus.sbrowser.contentblocker.engine.EngineService; 26 import org.adblockplus.sbrowser.contentblocker.engine.EngineService;
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 import org.adblockplus.sbrowser.contentblocker.preferences.MultilineCheckBoxPref erence;
29 30
30 import android.content.Context; 31 import android.content.Context;
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; 37 import android.view.View;
38 import android.view.ViewGroup; 38 import android.view.ViewGroup;
39 39
40 public class MoreBlockingPreferenceCategory extends PreferenceCategory implement s 40 public class MoreBlockingPreferenceCategory extends PreferenceCategory implement s
41 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener 41 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 for (final SubscriptionInfo sub : subs) 105 for (final SubscriptionInfo sub : subs)
106 { 106 {
107 final DefaultSubscriptionInfo info = engine.getDefaultSubscriptionInfoFo rUrl(sub.getUrl()); 107 final DefaultSubscriptionInfo info = engine.getDefaultSubscriptionInfoFo rUrl(sub.getUrl());
108 108
109 Integer resInt = URL_TO_RES_ID_MAP.get(sub.getUrl()); 109 Integer resInt = URL_TO_RES_ID_MAP.get(sub.getUrl());
110 if (!(aaLink.equals(sub.getUrl()) || sub.getTitle().startsWith("__")) 110 if (!(aaLink.equals(sub.getUrl()) || sub.getTitle().startsWith("__"))
111 && resInt != null 111 && resInt != null
112 && (info == null || info.getPrefixes().isEmpty() || sub.getType() != SubscriptionInfo.Type.ADS)) 112 && (info == null || info.getPrefixes().isEmpty() || sub.getType() != SubscriptionInfo.Type.ADS))
113 { 113 {
114 114
115 final CheckBoxPreference cbp = new CheckBoxPreference(this.getContext( )); 115 final MultilineCheckBoxPreference cbp = new MultilineCheckBoxPreferenc e(this.getContext());
116 116
117 if (sub.isEnabled()) 117 if (sub.isEnabled())
118 { 118 {
119 final StringBuilder sb = new StringBuilder(); 119 final StringBuilder sb = new StringBuilder();
120 sb.append(this.getContext().getString(R.string.last_update)); 120 sb.append(this.getContext().getString(R.string.last_update));
121 sb.append(' '); 121 sb.append(' ');
122 final long timestamp = sub.getLastUpdateTime(); 122 final long timestamp = sub.getLastUpdateTime();
123 if (timestamp > 0) 123 if (timestamp > 0)
124 { 124 {
125 sb.append(DateUtils.formatDateTime(this.getContext(), timestamp, 125 sb.append(DateUtils.formatDateTime(this.getContext(), timestamp,
(...skipping 21 matching lines...) Expand all
147 public boolean onPreferenceChange(final Preference preference, final Object ne wValue) 147 public boolean onPreferenceChange(final Preference preference, final Object ne wValue)
148 { 148 {
149 final String id = preference.getKey(); 149 final String id = preference.getKey();
150 final boolean enabled = ((Boolean) newValue).booleanValue(); 150 final boolean enabled = ((Boolean) newValue).booleanValue();
151 151
152 this.engine.changeSubscriptionState(id, enabled); 152 this.engine.changeSubscriptionState(id, enabled);
153 153
154 return true; 154 return true;
155 } 155 }
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld