From 46a8831be1f4fde221e790308a555f116d0dbecc Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Thu, 4 Aug 2016 21:28:53 +0300 Subject: Snap: Make developer menu more accessible * Not all devices have red eye reduction, which made it impossible to enable advanced options. Move the toggle to max brightness option which is present in all devices. * Allow enabling advanced options through camcorder settings. * Move hardcoded strings to cm_strings for translations. * Close menus when developer mode is toggled so we can see the extra options when the menu is reopened. * Decrease taps to 7, matching Settings tap-to-enable. * Properly reset tap counter. Change-Id: Iac39b9309388b92bf75a49a6091b483b13bd9154 --- res/values/cm_strings.xml | 4 +++ src/com/android/camera/PhotoMenu.java | 51 ++++++++++++++++++----------------- src/com/android/camera/VideoMenu.java | 28 ++++++++++++++++++- 3 files changed, 58 insertions(+), 25 deletions(-) diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index fa90e8b2a..e82717eb1 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -251,4 +251,8 @@ 30 Auto HDR enabled + + + You have enabled advanced camera options + You have disabled advanced camera options diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java index df278a9a9..db77b2c40 100644 --- a/src/com/android/camera/PhotoMenu.java +++ b/src/com/android/camera/PhotoMenu.java @@ -80,7 +80,7 @@ public class PhotoMenu extends MenuController private static final int PREVIEW_MENU_ON = 2; private static final int MODE_SCENE = 0; private static final int MODE_FILTER = 1; - private static final int DEVELOPER_MENU_TOUCH_COUNT = 10; + private static final int DEVELOPER_MENU_TOUCH_COUNT = 7; private int mSceneStatus; private View mHdrSwitcher; private View mFrontBackSwitcher; @@ -97,7 +97,7 @@ public class PhotoMenu extends MenuController private String mPrevSavedCDS; private boolean mIsTNREnabled = false; private boolean mIsCDSUpdated = false; - private int privateCounter = 0; + private int mPrivateCounter = 0; private static final int ANIMATION_DURATION = 300; private int previewMenuSize; private Rect mTmpRect = new Rect(); @@ -999,28 +999,6 @@ public class PhotoMenu extends MenuController } public void onPreferenceClicked(ListPreference pref, int y) { - // Developer menu - if (pref.getKey().equals(CameraSettings.KEY_REDEYE_REDUCTION)) { - privateCounter++; - if (privateCounter >= DEVELOPER_MENU_TOUCH_COUNT) { - SharedPreferences prefs = PreferenceManager - .getDefaultSharedPreferences(mActivity); - if (!mActivity.isDeveloperMenuEnabled()) { - mActivity.enableDeveloperMenu(); - prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, true).apply(); - RotateTextToast.makeText(mActivity, - "Camera developer option is enabled now", Toast.LENGTH_SHORT).show(); - } else { - mActivity.disableDeveloperMenu(); - prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, false).apply(); - RotateTextToast.makeText(mActivity, - "Camera developer option is disabled now", Toast.LENGTH_SHORT).show(); - } - } - } else { - privateCounter = 0; - } - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( Context.LAYOUT_INFLATER_SERVICE); ListSubMenu basic = (ListSubMenu) inflater.inflate( @@ -1036,6 +1014,31 @@ public class PhotoMenu extends MenuController mUI.showPopup(mListSubMenu, 2, true); } mPopupStatus = POPUP_SECOND_LEVEL; + + // Developer menu + if (pref.getKey().equals(CameraSettings.KEY_MAX_BRIGHTNESS)) { + mPrivateCounter++; + if (mPrivateCounter >= DEVELOPER_MENU_TOUCH_COUNT) { + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(mActivity); + if (!mActivity.isDeveloperMenuEnabled()) { + mActivity.enableDeveloperMenu(); + prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, true).apply(); + closeAllView(); + RotateTextToast.makeText(mActivity, + R.string.developer_menu_enabled, Toast.LENGTH_SHORT).show(); + } else { + mActivity.disableDeveloperMenu(); + prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, false).apply(); + closeAllView(); + RotateTextToast.makeText(mActivity, + R.string.developer_menu_disabled, Toast.LENGTH_SHORT).show(); + } + mPrivateCounter = 0; + } + } else { + mPrivateCounter = 0; + } } public void onListMenuTouched() { diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java index 0da3e117a..054db5d90 100644 --- a/src/com/android/camera/VideoMenu.java +++ b/src/com/android/camera/VideoMenu.java @@ -76,6 +76,7 @@ public class VideoMenu extends MenuController private static final int PREVIEW_MENU_IN_ANIMATION = 1; private static final int PREVIEW_MENU_ON = 2; private static final int MODE_FILTER = 1; + private static final int DEVELOPER_MENU_TOUCH_COUNT = 7; private int mSceneStatus; private View mFrontBackSwitcher; private View mFilterModeSwitcher; @@ -85,6 +86,7 @@ public class VideoMenu extends MenuController private String mPrevSavedVideoCDS; private boolean mIsVideoTNREnabled = false; private boolean mIsVideoCDSUpdated = false; + private int mPrivateCounter = 0; private static final int ANIMATION_DURATION = 300; private int previewMenuSize; private Rect mTmpRect = new Rect(); @@ -734,7 +736,6 @@ public class VideoMenu extends MenuController public void onPreferenceClicked(ListPreference pref, int y) { LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( Context.LAYOUT_INFLATER_SERVICE); - ListSubMenu basic = (ListSubMenu) inflater.inflate( R.layout.list_sub_menu, null, false); basic.initialize(pref, y); @@ -747,6 +748,31 @@ public class VideoMenu extends MenuController mUI.showPopup(mListSubMenu, 2, true); } mPopupStatus = POPUP_SECOND_LEVEL; + + // Developer menu + if (pref.getKey().equals(CameraSettings.KEY_MAX_BRIGHTNESS)) { + mPrivateCounter++; + if (mPrivateCounter >= DEVELOPER_MENU_TOUCH_COUNT) { + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(mActivity); + if (!mActivity.isDeveloperMenuEnabled()) { + mActivity.enableDeveloperMenu(); + prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, true).apply(); + closeAllView(); + RotateTextToast.makeText(mActivity, + R.string.developer_menu_enabled, Toast.LENGTH_SHORT).show(); + } else { + mActivity.disableDeveloperMenu(); + prefs.edit().putBoolean(CameraSettings.KEY_DEVELOPER_MENU, false).apply(); + closeAllView(); + RotateTextToast.makeText(mActivity, + R.string.developer_menu_disabled, Toast.LENGTH_SHORT).show(); + } + mPrivateCounter = 0; + } + } else { + mPrivateCounter = 0; + } } public void onListMenuTouched() { -- cgit v1.2.3