Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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") | |
Felix Dahlke
2014/04/28 07:29:01
As before, not a fan. Also below.
René Jeschke
2014/04/28 08:34:32
Done.
| |
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 Loading... | |
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 } |
LEFT | RIGHT |