summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-11-29 22:56:25 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-29 22:56:25 -0800
commit36320a204da24e41041712d583fde22ed78b1155 (patch)
tree78f4fc23b553e190023eb29806f7f4191cbd7544 /src/com
parentaa10c5120854bb1306ff67f03dc19347ee350e98 (diff)
parente747919853dfcbe29969647d7bf83269056d77bc (diff)
downloadLegacyCamera-36320a204da24e41041712d583fde22ed78b1155.zip
LegacyCamera-36320a204da24e41041712d583fde22ed78b1155.tar.gz
LegacyCamera-36320a204da24e41041712d583fde22ed78b1155.tar.bz2
Merge "Move scene mode to indicator wheel."
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/Camera.java3
-rw-r--r--src/com/android/camera/IconListPreference.java17
-rw-r--r--src/com/android/camera/ui/BasicSettingPopup.java17
-rw-r--r--src/com/android/camera/ui/IndicatorButton.java11
4 files changed, 33 insertions, 15 deletions
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());
+ }
}
}