add restore preference function
restore preference ui after restore button
Change-Id: I9a3e2077e925bba4a09e0304d1af1ad083db64b4
diff --git a/src/com/android/camera/SettingsActivity.java b/src/com/android/camera/SettingsActivity.java
index db788d5..ac4f6f7 100755
--- a/src/com/android/camera/SettingsActivity.java
+++ b/src/com/android/camera/SettingsActivity.java
@@ -879,8 +879,23 @@
private void restoreSettings() {
mSettingsManager.restoreSettings();
filterPreferences();
+ restoreAllPreference();
initializePreferences();
Toast.makeText(this, R.string.toast_settings_restored, Toast.LENGTH_SHORT).show();
}
+
+ private void restoreAllPreference(){
+ Map<String, SettingsManager.Values> map = mSettingsManager.getValuesMap();
+ if (map == null) return;
+ Set<Map.Entry<String, SettingsManager.Values>> set = map.entrySet();
+
+ for (Map.Entry<String, SettingsManager.Values> entry : set) {
+ String key = entry.getKey();
+ Preference p = findPreference(key);
+ if (p == null) continue;
+
+ p.setEnabled(true);
+ }
+ }
}