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

Delta Between Two Patch Sets: src/org/adblockplus/android/SummarizedPreferences.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Left Patch Set: Fixed leftover first-batch review issues. Created April 16, 2014, 5:51 p.m.
Right Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 a.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
« no previous file with change/comment | « src/org/adblockplus/android/SubscriptionParser.java ('k') | src/org/adblockplus/android/Utils.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 15 matching lines...) Expand all
26 import android.preference.Preference; 26 import android.preference.Preference;
27 import android.preference.PreferenceGroup; 27 import android.preference.PreferenceGroup;
28 import android.preference.PreferenceScreen; 28 import android.preference.PreferenceScreen;
29 29
30 /** 30 /**
31 * PreferencesActivity which automatically sets preference summaries according 31 * PreferencesActivity which automatically sets preference summaries according
32 * to its current values. 32 * to its current values.
33 */ 33 */
34 public class SummarizedPreferences extends SherlockPreferenceActivity implements OnSharedPreferenceChangeListener 34 public class SummarizedPreferences extends SherlockPreferenceActivity implements OnSharedPreferenceChangeListener
35 { 35 {
36 @SuppressWarnings("deprecation")
37 @Override 36 @Override
38 public void onResume() 37 public void onResume()
39 { 38 {
40 super.onResume(); 39 super.onResume();
41 initSummaries(getPreferenceScreen()); 40 initSummaries(getPreferenceScreen());
42 getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChang eListener(this); 41 getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChang eListener(this);
43 } 42 }
44 43
45 @SuppressWarnings("deprecation")
46 @Override 44 @Override
47 public void onPause() 45 public void onPause()
48 { 46 {
49 super.onPause(); 47 super.onPause();
50 getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceCha ngeListener(this); 48 getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceCha ngeListener(this);
51 } 49 }
52 50
53 @Override 51 @Override
54 public void onSharedPreferenceChanged(final SharedPreferences sharedPreference s, final String key) 52 public void onSharedPreferenceChanged(final SharedPreferences sharedPreference s, final String key)
55 { 53 {
56 @SuppressWarnings("deprecation")
57 final Preference pref = findPreference(key); 54 final Preference pref = findPreference(key);
58 setPrefSummary(pref); 55 setPrefSummary(pref);
59 } 56 }
60 57
61 protected void setPrefSummary(final Preference pref) 58 protected void setPrefSummary(final Preference pref)
62 { 59 {
63 if (pref instanceof ListPreference) 60 if (pref instanceof ListPreference)
64 { 61 {
65 final CharSequence summary = ((ListPreference) pref).getEntry(); 62 final CharSequence summary = ((ListPreference) pref).getEntry();
66 if (summary != null) 63 if (summary != null)
(...skipping 22 matching lines...) Expand all
89 initSummaries((PreferenceGroup) pref); 86 initSummaries((PreferenceGroup) pref);
90 } 87 }
91 else 88 else
92 { 89 {
93 setPrefSummary(pref); 90 setPrefSummary(pref);
94 } 91 }
95 } 92 }
96 } 93 }
97 94
98 } 95 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld