diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-29 17:07:07 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-29 17:10:40 +0800 |
commit | e747919853dfcbe29969647d7bf83269056d77bc (patch) | |
tree | 6dce6bf005fa3a992290a6ca065c8fe221c00bc8 | |
parent | ee1ce9805a4dba409fbf05457cac7f5991b571c5 (diff) | |
download | LegacyCamera-e747919853dfcbe29969647d7bf83269056d77bc.zip LegacyCamera-e747919853dfcbe29969647d7bf83269056d77bc.tar.gz LegacyCamera-e747919853dfcbe29969647d7bf83269056d77bc.tar.bz2 |
Move scene mode to indicator wheel.
bug:3156671
Change-Id: I8e663f7bfde805eeef06bf4f3d9b883a58e51ce5
-rw-r--r-- | res/layout-xlarge/other_setting_popup.xml | 2 | ||||
-rw-r--r-- | res/values/arrays.xml | 14 | ||||
-rw-r--r-- | res/values/attrs.xml | 2 | ||||
-rw-r--r-- | res/xml/camera_preferences.xml | 5 | ||||
-rw-r--r-- | res/xml/video_preferences.xml | 2 | ||||
-rw-r--r-- | src/com/android/camera/Camera.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/IconListPreference.java | 17 | ||||
-rw-r--r-- | src/com/android/camera/ui/BasicSettingPopup.java | 17 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorButton.java | 11 |
9 files changed, 39 insertions, 34 deletions
diff --git a/res/layout-xlarge/other_setting_popup.xml b/res/layout-xlarge/other_setting_popup.xml index 7c61d7b..d52a6c0 100644 --- a/res/layout-xlarge/other_setting_popup.xml +++ b/res/layout-xlarge/other_setting_popup.xml @@ -55,7 +55,5 @@ style="@style/SettingRow" /> <com.android.camera.ui.InLineSettingPicker camera:prefKey="pref_camera_jpegquality_key" style="@style/SettingRow" /> - <com.android.camera.ui.InLineSettingPicker camera:prefKey="pref_camera_scenemode_key" - style="@style/SettingRow" /> </LinearLayout> </com.android.camera.ui.OtherSettingsPopup> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index d50cebc..ce2e085 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -274,20 +274,6 @@ <item>green-tint</item> </string-array> - <!-- Color effect has no separate icons. --> - <array name="coloreffect_largeicons" translatable="false"> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - <item>@drawable/ic_viewfinder_coloreffect</item> - </array> - <array name="coloreffect_images" translatable="false"> <item>@drawable/btn_coloreffect_none</item> <item>@drawable/btn_coloreffect_mono</item> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 5238020..2ce9d42 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -28,6 +28,8 @@ <attr name="modes" format="reference" /> </declare-styleable> <declare-styleable name="IconListPreference"> + <!-- If a preference does not have individual icons for each entry, it can has a single icon to represent it. --> + <attr name="singleIcon" format="reference" /> <attr name="icons" /> <attr name="largeIcons" format="reference" /> <attr name="images" format="reference" /> diff --git a/res/xml/camera_preferences.xml b/res/xml/camera_preferences.xml index 1b3bcee..70cb4c0 100644 --- a/res/xml/camera_preferences.xml +++ b/res/xml/camera_preferences.xml @@ -30,10 +30,11 @@ camera:key="pref_camera_exposure_key" camera:defaultValue="@string/pref_exposure_default" camera:title="@string/pref_exposure_title" /> - <ListPreference + <IconListPreference camera:key="pref_camera_scenemode_key" camera:defaultValue="@string/pref_camera_scenemode_default" camera:title="@string/pref_camera_scenemode_title" + camera:singleIcon="@drawable/ic_viewfinder_camera_facing_back" camera:entries="@array/pref_camera_scenemode_entries" camera:entryValues="@array/pref_camera_scenemode_entryvalues" /> <IconListPreference @@ -48,7 +49,7 @@ camera:key="pref_camera_coloreffect_key" camera:defaultValue="@string/pref_camera_coloreffect_default" camera:title="@string/pref_camera_coloreffect_title" - camera:largeIcons="@array/coloreffect_largeicons" + camera:singleIcon="@drawable/ic_viewfinder_coloreffect" camera:images="@array/coloreffect_images" camera:entries="@array/pref_camera_coloreffect_entries" camera:entryValues="@array/pref_camera_coloreffect_entryvalues" /> diff --git a/res/xml/video_preferences.xml b/res/xml/video_preferences.xml index cc9871d..02e8ba4 100644 --- a/res/xml/video_preferences.xml +++ b/res/xml/video_preferences.xml @@ -58,7 +58,7 @@ camera:key="pref_camera_coloreffect_key" camera:defaultValue="@string/pref_camera_coloreffect_default" camera:title="@string/pref_camera_coloreffect_title" - camera:largeIcons="@array/coloreffect_largeicons" + camera:singleIcon="@drawable/ic_viewfinder_coloreffect" camera:images="@array/coloreffect_images" camera:entries="@array/pref_camera_coloreffect_entries" camera:entryValues="@array/pref_camera_coloreffect_entryvalues"/> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 2a099a4..2155d7d 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -1130,7 +1130,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private void initializeControlPanel() { String[] keys = new String[]{CameraSettings.KEY_FLASH_MODE, CameraSettings.KEY_WHITE_BALANCE, - CameraSettings.KEY_COLOR_EFFECT}; + CameraSettings.KEY_COLOR_EFFECT, + CameraSettings.KEY_SCENE_MODE}; mControlPanel = (ControlPanel) findViewById(R.id.control_panel); if (mControlPanel != null) { mControlPanel.initialize(this, mPreferenceGroup, keys, true); diff --git a/src/com/android/camera/IconListPreference.java b/src/com/android/camera/IconListPreference.java index 2a01e7e..d0bd441 100644 --- a/src/com/android/camera/IconListPreference.java +++ b/src/com/android/camera/IconListPreference.java @@ -27,7 +27,7 @@ import java.util.List; /** A {@code ListPreference} where each entry has a corresponding icon. */ public class IconListPreference extends ListPreference { - + private int mSingleIconId; private int mIconIds[]; private int mLargeIconIds[]; private int mImageIds[]; @@ -37,16 +37,21 @@ public class IconListPreference extends ListPreference { TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.IconListPreference, 0, 0); Resources res = context.getResources(); + mSingleIconId = a.getResourceId( + R.styleable.IconListPreference_singleIcon, 0); mIconIds = getIds(res, a.getResourceId( R.styleable.IconListPreference_icons, 0)); mLargeIconIds = getIds(res, a.getResourceId( R.styleable.IconListPreference_largeIcons, 0)); mImageIds = getIds(res, a.getResourceId( R.styleable.IconListPreference_images, 0)); - if (mImageIds == null) mImageIds = mLargeIconIds; a.recycle(); } + public int getSingleIcon() { + return mSingleIconId; + } + public int[] getIconIds() { return mIconIds; } @@ -86,17 +91,17 @@ public class IconListPreference extends ListPreference { IntArray largeIconIds = new IntArray(); IntArray imageIds = new IntArray(); - // We allow mIconsIds to be null, but not mLargeIconIds. The reason is that if large icons - // are unspecified, the on screen icons will be blank which is a bug. for (int i = 0, len = entryValues.length; i < len; i++) { if (supported.indexOf(entryValues[i].toString()) >= 0) { if (mIconIds != null) iconIds.add(mIconIds[i]); - largeIconIds.add(mLargeIconIds[i]); + if (mLargeIconIds != null) largeIconIds.add(mLargeIconIds[i]); if (mImageIds != null) imageIds.add(mImageIds[i]); } } if (mIconIds != null) mIconIds = iconIds.toArray(new int[iconIds.size()]); - mLargeIconIds = largeIconIds.toArray(new int[largeIconIds.size()]); + if (mLargeIconIds != null) { + mLargeIconIds = largeIconIds.toArray(new int[largeIconIds.size()]); + } if (mImageIds != null) mImageIds = imageIds.toArray(new int[imageIds.size()]); super.filterUnsupported(supported); } diff --git a/src/com/android/camera/ui/BasicSettingPopup.java b/src/com/android/camera/ui/BasicSettingPopup.java index d2725f6..f0636a1 100644 --- a/src/com/android/camera/ui/BasicSettingPopup.java +++ b/src/com/android/camera/ui/BasicSettingPopup.java @@ -59,7 +59,10 @@ public class BasicSettingPopup extends AbstractSettingPopup implements Context.LAYOUT_INFLATER_SERVICE); CharSequence[] entries = mPreference.getEntries(); CharSequence[] values = mPreference.getEntryValues(); - int[] imageIds = mPreference.getImageIds(); + int[] iconIds = mPreference.getImageIds(); + if (iconIds == null) { + iconIds = mPreference.getLargeIconIds(); + } int index = mPreference.findIndexOfValue(mPreference.getValue()); // Set title. @@ -75,11 +78,13 @@ public class BasicSettingPopup extends AbstractSettingPopup implements text.setClickable(false); if (index == i) text.setPressed(true); - // Initialize the image. - Drawable drawable = context.getResources().getDrawable(imageIds[i]); - ImageView image = (ImageView) row.findViewById(R.id.image); - image.setImageDrawable(drawable); - image.setClickable(false); + // Initialize the icon. + if (iconIds != null) { + Drawable drawable = context.getResources().getDrawable(iconIds[i]); + ImageView image = (ImageView) row.findViewById(R.id.image); + image.setImageDrawable(drawable); + image.setClickable(false); + } mContentPanel.addView(row); } } diff --git a/src/com/android/camera/ui/IndicatorButton.java b/src/com/android/camera/ui/IndicatorButton.java index c4145de..ab65a3e 100644 --- a/src/com/android/camera/ui/IndicatorButton.java +++ b/src/com/android/camera/ui/IndicatorButton.java @@ -32,7 +32,14 @@ public class IndicatorButton extends Button { } public void reloadPreference() { - int index = mPreference.findIndexOfValue(mPreference.getValue()); - setBackgroundResource(mPreference.getLargeIconIds()[index]); + int[] iconIds = mPreference.getLargeIconIds(); + if (iconIds != null) { + // Each entry has a corresponding icon. + int index = mPreference.findIndexOfValue(mPreference.getValue()); + setBackgroundResource(iconIds[index]); + } else { + // The preference only has a single icon to represent it. + setBackgroundResource(mPreference.getSingleIcon()); + } } } |