1 package de
.cwde
.shisensho
;
3 import android
.content
.SharedPreferences
;
4 import android
.content
.SharedPreferences
.OnSharedPreferenceChangeListener
;
5 import android
.os
.Bundle
;
6 import android
.preference
.*;
8 public class SettingsActivity
extends PreferenceActivity
9 implements OnSharedPreferenceChangeListener
{
11 private ShisenSho app
;
13 private static final String KEY_PREF_DIFF
= "pref_diff";
14 private static final String KEY_PREF_SIZE
= "pref_size";
15 //private static final String KEY_PREF_GRAV = "pref_grav";
16 //private static final String KEY_PREF_TIME = "pref_time";
18 @SuppressWarnings("deprecation")
20 public void onCreate(Bundle savedInstanceState
) {
21 super.onCreate(savedInstanceState
);
22 app
= ShisenSho
.app();
23 addPreferencesFromResource(R
.xml
.preferences
);
27 public void onBackPressed() {
29 super.onBackPressed();
32 @SuppressWarnings("deprecation")
34 protected void onResume() {
36 getPreferenceScreen().getSharedPreferences()
37 .registerOnSharedPreferenceChangeListener(this);
40 @SuppressWarnings("deprecation")
42 protected void onPause() {
44 getPreferenceScreen().getSharedPreferences()
45 .unregisterOnSharedPreferenceChangeListener(this);
49 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences
, String key
) {
50 if (key
.equals(KEY_PREF_DIFF
)) {
51 @SuppressWarnings("deprecation")
52 Preference myPref
= findPreference(key
);
53 // Set summary to be the user-description for the selected value
54 myPref
.setSummary(sharedPreferences
.getString(key
, ""));
56 if (key
.equals(KEY_PREF_SIZE
)) {
57 @SuppressWarnings("deprecation")
58 Preference myPref
= findPreference(key
);
59 // Set summary to be the user-description for the selected value
60 myPref
.setSummary(sharedPreferences
.getString(key
, ""));