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

Delta Between Two Patch Sets: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/ListedSubscriptionsPreferenceCategory.java

Issue 29453722: Noissue - Lint adjustments and optimizations (Closed)
Left Patch Set: Adjustments based on review comments Created June 13, 2017, 9:23 p.m.
Right Patch Set: Adjusting HashSet initialization in Subscription Created July 19, 2017, 4:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 import java.util.Locale; 23 import java.util.Locale;
24 24
25 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo; 25 import org.adblockplus.sbrowser.contentblocker.engine.DefaultSubscriptionInfo;
26 import org.adblockplus.sbrowser.contentblocker.engine.Engine; 26 import org.adblockplus.sbrowser.contentblocker.engine.Engine;
27 import org.adblockplus.sbrowser.contentblocker.engine.EngineService; 27 import org.adblockplus.sbrowser.contentblocker.engine.EngineService;
28 import org.adblockplus.sbrowser.contentblocker.engine.SubscriptionInfo; 28 import org.adblockplus.sbrowser.contentblocker.engine.SubscriptionInfo;
29 import org.adblockplus.sbrowser.contentblocker.preferences.MultilinePreferenceCa tegory;
29 import org.adblockplus.adblockplussbrowser.R; 30 import org.adblockplus.adblockplussbrowser.R;
30 31
31 import android.annotation.SuppressLint; 32 import android.annotation.SuppressLint;
32 import android.content.Context; 33 import android.content.Context;
33 import android.preference.CheckBoxPreference; 34 import android.preference.CheckBoxPreference;
34 import android.preference.Preference; 35 import android.preference.Preference;
35 import android.preference.PreferenceCategory;
36 import android.preference.Preference.OnPreferenceChangeListener; 36 import android.preference.Preference.OnPreferenceChangeListener;
37 import android.text.format.DateUtils; 37 import android.text.format.DateUtils;
38 import android.util.AttributeSet; 38 import android.util.AttributeSet;
39 import android.view.View;
40 import android.view.ViewGroup;
41 39
42 @SuppressLint("DefaultLocale") 40 @SuppressLint("DefaultLocale")
43 public class ListedSubscriptionsPreferenceCategory extends PreferenceCategory im plements 41 public class ListedSubscriptionsPreferenceCategory extends MultilinePreferenceCa tegory implements
44 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener 42 EngineService.OnEngineCreatedCallback, OnPreferenceChangeListener
45 { 43 {
46 private Engine engine = null; 44 private Engine engine = null;
47 private boolean isEnabledView = false; 45 private boolean isEnabledView = false;
48 46
49 private static final String[] LANGUAGE_TRANSLATIONS = 47 private static final String[] LANGUAGE_TRANSLATIONS =
50 { 48 {
51 "id", "Bahasa Indonesia", 49 "id", "Bahasa Indonesia",
52 "he", "עברית" 50 "he", "עברית"
53 }; 51 };
54 52
55 private static final HashMap<String, String> LANGUAGE_TRANSLATION_MAP = new Ha shMap<>(); 53 private static final HashMap<String, String> LANGUAGE_TRANSLATION_MAP = new Ha shMap<>();
56 54
57 static 55 static
58 { 56 {
59 for (int i = 0; i < LANGUAGE_TRANSLATIONS.length; i += 2) 57 for (int i = 0; i < LANGUAGE_TRANSLATIONS.length; i += 2)
60 { 58 {
61 LANGUAGE_TRANSLATION_MAP.put(LANGUAGE_TRANSLATIONS[i], LANGUAGE_TRANSLATIO NS[i + 1]); 59 LANGUAGE_TRANSLATION_MAP.put(LANGUAGE_TRANSLATIONS[i], LANGUAGE_TRANSLATIO NS[i + 1]);
62 } 60 }
63 } 61 }
64 62
65 public ListedSubscriptionsPreferenceCategory(final Context context) 63 public ListedSubscriptionsPreferenceCategory(final Context context)
66 { 64 {
67 super(context); 65 super(context);
68 } 66 }
69 67
70 public ListedSubscriptionsPreferenceCategory(final Context context, final Attr ibuteSet attrs) 68 public ListedSubscriptionsPreferenceCategory(final Context context, final Attr ibuteSet attrs)
71 { 69 {
72 super(context, attrs); 70 super(context, attrs);
73 }
74
75 @Override
76 protected View onCreateView(final ViewGroup parent)
77 {
78 return super.onCreateView(parent);
79 } 71 }
80 72
81 @Override 73 @Override
82 protected void onAttachedToActivity() 74 protected void onAttachedToActivity()
83 { 75 {
84 EngineService.startService(this.getContext().getApplicationContext(), this); 76 EngineService.startService(this.getContext().getApplicationContext(), this);
85 super.onAttachedToActivity(); 77 super.onAttachedToActivity();
86 } 78 }
87 79
88 @Override 80 @Override
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 public boolean onPreferenceChange(final Preference preference, final Object ne wValue) 183 public boolean onPreferenceChange(final Preference preference, final Object ne wValue)
192 { 184 {
193 final String id = preference.getKey(); 185 final String id = preference.getKey();
194 final boolean enabled = (Boolean) newValue; 186 final boolean enabled = (Boolean) newValue;
195 187
196 this.engine.changeSubscriptionState(id, enabled); 188 this.engine.changeSubscriptionState(id, enabled);
197 189
198 return true; 190 return true;
199 } 191 }
200 } 192 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld