summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-01-25 17:09:52 -0800
committerOwen Lin <owenlin@google.com>2010-01-26 09:59:22 -0800
commit52064aa4bacfae605823b99f675649b1786e8c8a (patch)
tree9433458a198833db6e60eebcc8ece9cdbf762b58 /src
parent8791695ba110ad0b088d2e8b3b0127c0042e1865 (diff)
downloadLegacyCamera-52064aa4bacfae605823b99f675649b1786e8c8a.zip
LegacyCamera-52064aa4bacfae605823b99f675649b1786e8c8a.tar.gz
LegacyCamera-52064aa4bacfae605823b99f675649b1786e8c8a.tar.bz2
Fix a minor issue of "restore default" should also improve
performance as well. Change-Id: I1a762ed78dc27bb711b652431481925c9bd1b8b5
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java5
-rw-r--r--src/com/android/camera/CameraPreference.java2
-rw-r--r--src/com/android/camera/ListPreference.java5
-rw-r--r--src/com/android/camera/OnScreenSettings.java8
-rw-r--r--src/com/android/camera/PreferenceGroup.java7
-rw-r--r--src/com/android/camera/VideoCamera.java11
6 files changed, 22 insertions, 16 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index a1a99af..b71165b 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1085,11 +1085,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener,
mSettings.clearSettings();
CameraSettings.upgradePreferences(mPreferences);
setCameraParameters();
-
- // We reload the preference again to reload the new data
- mSettings.setPreferenceGroup(
- new CameraSettings(this, mParameters)
- .getPreferenceGroup(R.xml.camera_preferences));
mPreferences.registerOnSharedPreferenceChangeListener(this);
}
diff --git a/src/com/android/camera/CameraPreference.java b/src/com/android/camera/CameraPreference.java
index e44700b..f71a6bb 100644
--- a/src/com/android/camera/CameraPreference.java
+++ b/src/com/android/camera/CameraPreference.java
@@ -51,4 +51,6 @@ public abstract class CameraPreference {
}
return mSharedPreferences;
}
+
+ public abstract void reloadValue();
}
diff --git a/src/com/android/camera/ListPreference.java b/src/com/android/camera/ListPreference.java
index 4076277..ce2fb5a 100644
--- a/src/com/android/camera/ListPreference.java
+++ b/src/com/android/camera/ListPreference.java
@@ -105,4 +105,9 @@ public class ListPreference extends CameraPreference {
editor.putString(mKey, value);
editor.commit();
}
+
+ @Override
+ public void reloadValue() {
+ this.mLoaded = false;
+ }
}
diff --git a/src/com/android/camera/OnScreenSettings.java b/src/com/android/camera/OnScreenSettings.java
index 83eb2b9..6b09bf2 100644
--- a/src/com/android/camera/OnScreenSettings.java
+++ b/src/com/android/camera/OnScreenSettings.java
@@ -80,6 +80,7 @@ public class OnScreenSettings {
private final LayoutInflater mInflater;
private Runnable mRestoreRunner;
+ private PreferenceGroup mPreferenceGroup;
// We store the override values here. For a given preference,
// if the mapping value of the preference key is not null, we will
@@ -118,6 +119,11 @@ public class OnScreenSettings {
.getDefaultSharedPreferences(mContext).edit();
editor.clear();
editor.commit();
+
+ mPreferenceGroup.reloadValue();
+ if (mMainAdapter != null) {
+ mMainAdapter.notifyDataSetChanged();
+ }
mOverride.clear();
}
@@ -284,6 +290,8 @@ public class OnScreenSettings {
}
public void setPreferenceGroup(PreferenceGroup group) {
+ this.mPreferenceGroup = group;
+
ArrayList<CameraPreference> list = new ArrayList<CameraPreference>();
// We don't want the root group added to the list. So, we add the
diff --git a/src/com/android/camera/PreferenceGroup.java b/src/com/android/camera/PreferenceGroup.java
index d4972f8..720e8a2 100644
--- a/src/com/android/camera/PreferenceGroup.java
+++ b/src/com/android/camera/PreferenceGroup.java
@@ -49,6 +49,13 @@ public class PreferenceGroup extends CameraPreference {
return list.size();
}
+ @Override
+ public void reloadValue() {
+ for (CameraPreference pref : list) {
+ pref.reloadValue();
+ }
+ }
+
/**
* Finds the preference with the given key recursively. Returns
* <code>null</code> if cannot find.
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index a2e490c..b2c6f5e 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1078,17 +1078,6 @@ public class VideoCamera extends NoSearchActivity
readVideoPreferences();
resetCameraParameters();
- // If we start preview and reload the settings UI in a row. The
- // preview will become a white screen. So, we reload the settings UI
- // later.
- mHandler.post(new Runnable() {
- public void run() {
- // We reload the preference again to reload the new data
- mSettings.setPreferenceGroup(
- new CameraSettings(VideoCamera.this, mParameters)
- .getPreferenceGroup(R.xml.video_preferences));
- }
- });
mPreferences.registerOnSharedPreferenceChangeListener(this);
}