preferences show current values in summary

This commit is contained in:
Ronald Schaten 2011-06-08 14:46:24 +02:00
parent a6f93ff8b0
commit 98b40a5d19
2 changed files with 8 additions and 1 deletions

View File

@ -178,7 +178,7 @@ public class DatePreference extends DialogPreference implements
private void persistDate(String s) {
persistString(s);
//setSummary(summaryFormatter().format(getDate().getTime()));
setSummary(summaryFormatter().format(getDate().getTime()));
}
/**

View File

@ -71,6 +71,7 @@ public class WaldemarPreferences extends PreferenceActivity {
final EditTextPreference pref_name = (EditTextPreference)findPreference("pref_name");
final ListPreference pref_mode = (ListPreference)findPreference("pref_mode");
final EditTextPreference pref_duration = (EditTextPreference)findPreference("pref_duration");
String val = pref_mode.getValue();
enableDisablePreferences(val);
@ -88,6 +89,12 @@ public class WaldemarPreferences extends PreferenceActivity {
return true;
}
});
pref_duration.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
pref_duration.setSummary((CharSequence)newValue);
return true;
}
});
}
@Override