diff options
author | Jack Yoo <jyoo@codeaurora.org> | 2015-12-17 16:53:36 -0800 |
---|---|---|
committer | Camera Software Integration <camswint@localhost> | 2016-01-24 13:02:06 -0700 |
commit | 5cca0e8991ee9fa3f30805944390055d410fefd3 (patch) | |
tree | 01fcb7be2cab284e83e3267e100b893c63e72364 /src | |
parent | d8d2eb6ce6d67354be9c38f9a23c7b9cd22457d2 (diff) | |
download | android_packages_apps_Snap-5cca0e8991ee9fa3f30805944390055d410fefd3.tar.gz android_packages_apps_Snap-5cca0e8991ee9fa3f30805944390055d410fefd3.tar.bz2 android_packages_apps_Snap-5cca0e8991ee9fa3f30805944390055d410fefd3.zip |
SnapdragonCamera: Color Effect shows the current status
Let the icon shows the current status of the color effect on/off
Change-Id: I1c3719db15d4dd920b89591064cda372c7ab89be
CRs-Fixed: 951550
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/PhotoMenu.java | 27 | ||||
-rw-r--r-- | src/com/android/camera/VideoMenu.java | 29 |
3 files changed, 50 insertions, 7 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 407f879cf..180a46097 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -84,6 +84,7 @@ public class CameraSettings { public static final String KEY_PICTURE_FORMAT = "pref_camera_pictureformat_key"; public static final String KEY_ZSL = "pref_camera_zsl_key"; public static final String KEY_CAMERA_SAVEPATH = "pref_camera_savepath_key"; + public static final String KEY_FILTER_MODE = "pref_camera_filter_mode_key"; public static final String KEY_COLOR_EFFECT = "pref_camera_coloreffect_key"; public static final String KEY_FACE_DETECTION = "pref_camera_facedetection_key"; public static final String KEY_TOUCH_AF_AEC = "pref_camera_touchafaec_key"; diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java index 83ceff0b6..2cb544e6e 100644 --- a/src/com/android/camera/PhotoMenu.java +++ b/src/com/android/camera/PhotoMenu.java @@ -1085,14 +1085,18 @@ public class PhotoMenu extends MenuController public void initFilterModeButton(View button) { button.setVisibility(View.INVISIBLE); final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_COLOR_EFFECT); + .findPreference(CameraSettings.KEY_FILTER_MODE); if (pref == null) return; int[] iconIds = pref.getLargeIconIds(); + int index = pref.findIndexOfValue(pref.getValue()); int resid = -1; - // The preference only has a single icon to represent it. - resid = pref.getSingleIcon(); + if (!pref.getUseSingleIcon() && iconIds != null) { + resid = iconIds[index]; + } else { + resid = pref.getSingleIcon(); + } ((ImageView) button).setImageResource(resid); button.setVisibility(View.VISIBLE); button.setOnClickListener(new OnClickListener() { @@ -1188,6 +1192,7 @@ public class PhotoMenu extends MenuController } else if (event.getAction() == MotionEvent.ACTION_UP) { if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) { pref.setValueIndex(j); + changeFilterModeControlIcon(pref.getValue()); onSettingChanged(pref); for (View v1 : views) { v1.setBackground(null); @@ -1212,6 +1217,22 @@ public class PhotoMenu extends MenuController mPreviewMenu = basic; } + private void changeFilterModeControlIcon(String value) { + if(!value.equals("")) { + if(value.equalsIgnoreCase(mActivity.getString(R.string.pref_camera_coloreffect_entry_none))) { + value = mActivity.getString(R.string.pref_camera_filter_mode_entry_off); + } else { + value = mActivity.getString(R.string.pref_camera_filter_mode_entry_on); + } + final IconListPreference pref = (IconListPreference) mPreferenceGroup + .findPreference(CameraSettings.KEY_FILTER_MODE); + pref.setValue(value); + int index = pref.getCurrentIndex(); + ImageView iv = (ImageView) mFilterModeSwitcher; + iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]); + } + } + public void openFirstLevel() { if (isMenuBeingShown() || CameraControls.isAnimating()) { return; diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java index 6998cbf0e..dcca97d68 100644 --- a/src/com/android/camera/VideoMenu.java +++ b/src/com/android/camera/VideoMenu.java @@ -502,14 +502,18 @@ public class VideoMenu extends MenuController public void initFilterModeButton(View button) { button.setVisibility(View.INVISIBLE); final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_COLOR_EFFECT); + .findPreference(CameraSettings.KEY_FILTER_MODE); if (pref == null) return; int[] iconIds = pref.getLargeIconIds(); + int index = pref.findIndexOfValue(pref.getValue()); int resid = -1; - // The preference only has a single icon to represent it. - resid = pref.getSingleIcon(); + if (!pref.getUseSingleIcon() && iconIds != null) { + resid = iconIds[index]; + } else { + resid = pref.getSingleIcon(); + } ((ImageView) button).setImageResource(resid); button.setVisibility(View.VISIBLE); button.setOnClickListener(new OnClickListener() { @@ -611,6 +615,7 @@ public class VideoMenu extends MenuController } else if (event.getAction() == MotionEvent.ACTION_UP) { if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) { pref.setValueIndex(j); + changeFilterModeControlIcon(pref.getValue()); for (View v1 : views) { v1.setBackground(null); } @@ -636,6 +641,22 @@ public class VideoMenu extends MenuController mPreviewMenu = basic; } + private void changeFilterModeControlIcon(String value) { + if(!value.equals("")) { + if(value.equalsIgnoreCase(mActivity.getString(R.string.pref_camera_coloreffect_entry_none))) { + value = mActivity.getString(R.string.pref_camera_filter_mode_entry_off); + } else { + value = mActivity.getString(R.string.pref_camera_filter_mode_entry_on); + } + final IconListPreference pref = (IconListPreference) mPreferenceGroup + .findPreference(CameraSettings.KEY_FILTER_MODE); + pref.setValue(value); + int index = pref.getCurrentIndex(); + ImageView iv = (ImageView) mFilterModeSwitcher; + iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]); + } + } + public void openFirstLevel() { if (isMenuBeingShown() || CameraControls.isAnimating()) return; @@ -787,7 +808,7 @@ public class VideoMenu extends MenuController public void showUI() { mFrontBackSwitcher.setVisibility(View.VISIBLE); final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_COLOR_EFFECT); + .findPreference(CameraSettings.KEY_FILTER_MODE); if (pref != null) { mFilterModeSwitcher.setVisibility(View.VISIBLE); } |