]> cvs.zerfleddert.de Git - FreeShisen/blobdiff - src/de/cwde/freeshisen/SettingsActivity.java
remove some hardcoded strings
[FreeShisen] / src / de / cwde / freeshisen / SettingsActivity.java
index fbc87ae25bdf8fed3c49621b9aa307904d1dc48f..26a63f9f435efde4bed8d31c2ad5f8c2c8d781eb 100644 (file)
@@ -13,6 +13,7 @@ implements OnSharedPreferenceChangeListener {
 
        private static final String KEY_PREF_DIFF = "pref_diff";
        private static final String KEY_PREF_SIZE = "pref_size";
+       private static final String KEY_PREF_TILE = "pref_tile";
        //private static final String KEY_PREF_GRAV = "pref_grav";
        //private static final String KEY_PREF_TIME = "pref_time";
 
@@ -27,11 +28,12 @@ implements OnSharedPreferenceChangeListener {
                sharedPreferences.registerOnSharedPreferenceChangeListener(this);
                updateSummary(sharedPreferences, KEY_PREF_DIFF, KEY_PREF_DIFF, R.array.difficulties);
                updateSummary(sharedPreferences, KEY_PREF_SIZE, KEY_PREF_SIZE, R.array.sizes);
+               updateTileSummary(sharedPreferences, KEY_PREF_TILE);
        }
 
        @Override
        public void onBackPressed() {
-               app.setOptions();
+               app.checkForChangedOptions();
                super.onBackPressed();
        }
 
@@ -51,10 +53,10 @@ implements OnSharedPreferenceChangeListener {
                .unregisterOnSharedPreferenceChangeListener(this);
        }
 
-
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
                updateSummary(sharedPreferences, key, KEY_PREF_DIFF, R.array.difficulties);
                updateSummary(sharedPreferences, key, KEY_PREF_SIZE, R.array.sizes);
+               updateTileSummary(sharedPreferences, key);
        }
 
        private void updateSummary(SharedPreferences sharedPreferences, String changedkey, String mykey, int myresource) {
@@ -70,5 +72,16 @@ implements OnSharedPreferenceChangeListener {
                        Preference myPref = findPreference(changedkey);
                        myPref.setSummary("Currently: " + name);
                }
-       }       
+       }
+
+       private void updateTileSummary(SharedPreferences sharedPreferences, String changedkey) {
+               if (changedkey.equals(KEY_PREF_TILE)) {
+                       String name = sharedPreferences.getString(KEY_PREF_TILE, "classic");
+
+                       @SuppressWarnings("deprecation")
+                       Preference myPref = findPreference(KEY_PREF_TILE);
+                       myPref.setSummary("Current Tileset: " + name);
+               }
+       }
+
 }
Impressum, Datenschutz