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

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

Issue 29674689: Issue 6289 - Fix OnSharedPreferenceChangeListener (Closed)
Left Patch Set: Created Jan. 19, 2018, 2:07 p.m.
Right Patch Set: Created Jan. 19, 2018, 2:36 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ? getString(R.string.add_subscription_dialog_message) 207 ? getString(R.string.add_subscription_dialog_message)
208 : getString(R.string.remove_subscription_dialog_message)); 208 : getString(R.string.remove_subscription_dialog_message));
209 } 209 }
210 210
211 @Override 211 @Override
212 public void subscriptionUpdatedApplied() 212 public void subscriptionUpdatedApplied()
213 { 213 {
214 this.dismissDialog(); 214 this.dismissDialog();
215 } 215 }
216 216
217 private SharedPrefsUtils.OnSharedPreferenceChangeListener listener = 217 private final SharedPrefsUtils.OnSharedPreferenceChangeListener listener =
diegocarloslima 2018/01/19 14:26:10 It's better to be final
jens 2018/01/19 14:36:07 Acknowledged.
218 new SharedPrefsUtils.OnSharedPreferenceChangeListener() 218 new SharedPrefsUtils.OnSharedPreferenceChangeListener()
219 { 219 {
220 @Override 220 @Override
221 protected void onSharedPreferenceChanged(String key) 221 protected void onSharedPreferenceChanged(String key)
222 { 222 {
223 if (getString(R.string.key_automatic_updates).equals(key) && engine != nul l) 223 if (getString(R.string.key_automatic_updates).equals(key) && engine != nul l)
224 { 224 {
225 engine.connectivityChanged(); 225 engine.connectivityChanged();
226 } 226 }
227 else if (getString(R.string.key_acceptable_ads).equals(key)) 227 else if (getString(R.string.key_acceptable_ads).equals(key))
228 { 228 {
229 final boolean enabled = SharedPrefsUtils.getBoolean 229 final boolean enabled = SharedPrefsUtils.getBoolean
230 (MainPreferences.this, R.string.key_acceptable_ads, true); 230 (MainPreferences.this, R.string.key_acceptable_ads, true);
231 final String id = "url:" + engine.getPrefsDefault(Engine.SUBSCRIPTIONS_E XCEPTIONSURL); 231 final String id = "url:" + engine.getPrefsDefault(Engine.SUBSCRIPTIONS_E XCEPTIONSURL);
232 Log.d(TAG, "Acceptable ads " + (enabled ? "enabled" : "disabled")); 232 Log.d(TAG, "Acceptable ads " + (enabled ? "enabled" : "disabled"));
233 engine.changeSubscriptionState(id, enabled); 233 engine.changeSubscriptionState(id, enabled);
234 } 234 }
235 else if (getString(R.string.key_application_activated).equals(key)) 235 else if (getString(R.string.key_application_activated).equals(key))
236 { 236 {
237 if (dialogTitleResId == R.string.setup_dialog_title) 237 if (dialogTitleResId == R.string.setup_dialog_title)
238 { 238 {
239 dismissDialog(); 239 dismissDialog();
240 } 240 }
241 } 241 }
242 } 242 }
243 }; 243 };
244 } 244 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld