summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/BasicIndicator.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-03-10 10:53:02 +0800
committerOwen Lin <owenlin@google.com>2010-03-14 16:52:10 +0800
commitc24155c65b45f554ffc29c523d7ea8e63ea10d33 (patch)
tree334b1fa881954897069231b978a80208aef9a555 /src/com/android/camera/ui/BasicIndicator.java
parent7da52284cebf4e292033975e428b21affb661d73 (diff)
downloadLegacyCamera-c24155c65b45f554ffc29c523d7ea8e63ea10d33.zip
LegacyCamera-c24155c65b45f554ffc29c523d7ea8e63ea10d33.tar.gz
LegacyCamera-c24155c65b45f554ffc29c523d7ea8e63ea10d33.tar.bz2
Restore Settings.
Change-Id: Ie5c26869151dd8959c122bf3c748d61420ac5c30
Diffstat (limited to 'src/com/android/camera/ui/BasicIndicator.java')
-rw-r--r--src/com/android/camera/ui/BasicIndicator.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/com/android/camera/ui/BasicIndicator.java b/src/com/android/camera/ui/BasicIndicator.java
index ed2d06a..f270efa 100644
--- a/src/com/android/camera/ui/BasicIndicator.java
+++ b/src/com/android/camera/ui/BasicIndicator.java
@@ -5,6 +5,7 @@ import android.content.Context;
import com.android.camera.R;
import com.android.camera.IconListPreference;
+import com.android.camera.PreferenceGroup;
import com.android.camera.Util;
import com.android.camera.ui.GLListView.OnItemSelectedListener;
@@ -17,22 +18,21 @@ public class BasicIndicator extends AbstractIndicator {
private PreferenceAdapter mModel;
private String mOverride;
- public BasicIndicator(Context context, IconListPreference preference) {
+ public BasicIndicator(Context context,
+ PreferenceGroup group, IconListPreference preference) {
super(context);
mPreference = preference;
mIcon = new ResourceTexture[preference.getIconIds().length];
mIndex = preference.findIndexOfValue(preference.getValue());
}
- @Override
- public void overrideSettings(String key, String settings) {
+ // Set the override and/or reload the value from preferences.
+ private void updateContent(String override, boolean reloadValue) {
+ if (!reloadValue && Util.equals(mOverride, override)) return;
IconListPreference pref = mPreference;
- if (!pref.getKey().equals(key)) return;
- if (Util.equals(mOverride, settings)) return;
-
- mOverride = settings;
+ mOverride = override;
int index = pref.findIndexOfValue(
- settings == null ? pref.getValue() : settings);
+ override == null ? pref.getValue() : override);
if (mIndex != index) {
mIndex = index;
invalidate();
@@ -40,6 +40,19 @@ public class BasicIndicator extends AbstractIndicator {
}
@Override
+ public void overrideSettings(String key, String settings) {
+ IconListPreference pref = mPreference;
+ if (!pref.getKey().equals(key)) return;
+ updateContent(settings, false);
+ }
+
+ @Override
+ public void reloadPreferences() {
+ if (mModel != null) mModel.reload();
+ updateContent(null, true);
+ }
+
+ @Override
public GLView getPopupContent() {
if (mPopupContent == null) {
Context context = getGLRootView().getContext();