diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-07-06 16:38:58 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-07-08 13:46:00 +0800 |
commit | 039f1dc1fd89b5baeed8be05f3f21770cf75d4b3 (patch) | |
tree | 30c73cafac96c406ff320d7bc33827dfa7d0632a /src/com/android/camera/ui/IndicatorButton.java | |
parent | 3008e86ddbf854e9fb6a247b6fa9f267d44886ba (diff) | |
download | LegacyCamera-039f1dc1fd89b5baeed8be05f3f21770cf75d4b3.zip LegacyCamera-039f1dc1fd89b5baeed8be05f3f21770cf75d4b3.tar.gz LegacyCamera-039f1dc1fd89b5baeed8be05f3f21770cf75d4b3.tar.bz2 |
Move zoom buttons and front/back camera switch to indicator wheel.
bug:5001059
Change-Id: I5ed60169b6f73dc41d84ba7bd299ed8bf394a284
Diffstat (limited to 'src/com/android/camera/ui/IndicatorButton.java')
-rw-r--r-- | src/com/android/camera/ui/IndicatorButton.java | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/src/com/android/camera/ui/IndicatorButton.java b/src/com/android/camera/ui/IndicatorButton.java index 280c9d0..deb2344 100644 --- a/src/com/android/camera/ui/IndicatorButton.java +++ b/src/com/android/camera/ui/IndicatorButton.java @@ -17,21 +17,33 @@ package com.android.camera.ui; import com.android.camera.IconListPreference; +import com.android.camera.R; import android.content.Context; -import android.widget.ImageView; import android.util.Log; +import android.view.LayoutInflater; +import android.view.ViewGroup; -public class IndicatorButton extends ImageView { +// An indicator button that represents one camera setting. Ex: flash. Pressing it opens a popup +// window. +public class IndicatorButton extends AbstractIndicatorButton implements BasicSettingPopup.Listener { private final String TAG = "IndicatorButton"; private IconListPreference mPreference; // Scene mode can override the original preference value. private String mOverrideValue; + private Listener mListener; + + static public interface Listener { + public void onSettingChanged(); + } + + public void setSettingChangedListener(Listener listener) { + mListener = listener; + } public IndicatorButton(Context context, IconListPreference pref) { super(context); mPreference = pref; - setClickable(false); reloadPreference(); } @@ -62,12 +74,44 @@ public class IndicatorButton extends ImageView { return mPreference.getKey(); } + @Override public boolean isOverridden() { return mOverrideValue != null; } - public void overrideSettings(String value) { - mOverrideValue = value; + @Override + public void overrideSettings(final String ... keyvalues) { + mOverrideValue = null; + for (int i = 0; i < keyvalues.length; i += 2) { + String key = keyvalues[i]; + String value = keyvalues[i + 1]; + if (key.equals(getKey())) { + mOverrideValue = value; + setEnabled(value == null); + break; + } + } reloadPreference(); } + + @Override + protected void initializePopup() { + LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + ViewGroup root = (ViewGroup) getRootView().findViewById(R.id.app_root); + + BasicSettingPopup popup = (BasicSettingPopup) inflater.inflate( + R.layout.basic_setting_popup, root, false); + popup.setSettingChangedListener(this); + popup.initialize(mPreference); + root.addView(popup); + mPopup = popup; + } + + public void onSettingChanged() { + reloadPreference(); + if (mListener != null) { + mListener.onSettingChanged(); + } + } } |