Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 package org.adblockplus.android; | 1 package org.adblockplus.android; |
2 | 2 |
3 import android.content.SharedPreferences; | 3 import android.content.SharedPreferences; |
4 import android.content.SharedPreferences.OnSharedPreferenceChangeListener; | 4 import android.content.SharedPreferences.OnSharedPreferenceChangeListener; |
5 import android.preference.EditTextPreference; | 5 import android.preference.EditTextPreference; |
6 import android.preference.ListPreference; | 6 import android.preference.ListPreference; |
7 import android.preference.Preference; | 7 import android.preference.Preference; |
8 import android.preference.PreferenceActivity; | 8 import android.preference.PreferenceActivity; |
9 import android.preference.PreferenceGroup; | 9 import android.preference.PreferenceGroup; |
10 import android.preference.PreferenceScreen; | 10 import android.preference.PreferenceScreen; |
11 | 11 |
12 /** | 12 /** |
13 * PreferencesActivity which automatically sets preference summaries according | 13 * PreferencesActivity which automatically sets preference summaries according |
14 * to its current values. | 14 * to its current values. |
15 */ | 15 */ |
16 public class SummarizedPreferences extends PreferenceActivity implements OnShare dPreferenceChangeListener | 16 public class SummarizedPreferences extends PreferenceActivity implements OnShare dPreferenceChangeListener |
17 { | 17 { |
18 @Override | 18 @Override |
19 public void onResume() | 19 public void onResume() |
20 { | 20 { |
21 super.onResume(); | 21 super.onResume(); |
22 // initialize list summaries | |
Felix Dahlke
2012/10/09 14:27:29
Why not call initSummaries() initListSummaries() t
Andrey Novikov
2012/10/12 13:19:14
The comment was wrong, I've coped it from my old c
| |
23 initSummaries(getPreferenceScreen()); | 22 initSummaries(getPreferenceScreen()); |
24 getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChang eListener(this); | 23 getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChang eListener(this); |
25 } | 24 } |
26 | 25 |
27 @Override | 26 @Override |
28 public void onPause() | 27 public void onPause() |
29 { | 28 { |
30 super.onPause(); | 29 super.onPause(); |
31 getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceCha ngeListener(this); | 30 getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceCha ngeListener(this); |
32 } | 31 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 initSummaries((PreferenceGroup) pref); | 68 initSummaries((PreferenceGroup) pref); |
70 } | 69 } |
71 else | 70 else |
72 { | 71 { |
73 setPrefSummary(pref); | 72 setPrefSummary(pref); |
74 } | 73 } |
75 } | 74 } |
76 } | 75 } |
77 | 76 |
78 } | 77 } |
LEFT | RIGHT |