From 3d7fe526c4339d40b8e0ad380ea3c7c6e0a32d9b 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 | 50 +++++++++++++++++++---------------- src/com/android/camera/VideoMenu.java | 31 +++++++++++++++++++++- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 410fa0b99..691358a4c 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -145,4 +145,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 98ae97835..04346ebff 100644 --- a/src/com/android/camera/PhotoMenu.java +++ b/src/com/android/camera/PhotoMenu.java @@ -92,7 +92,7 @@ public class PhotoMenu extends MenuController private static final int MODE_SCENE = 0; private static final int MODE_FILTER = 1; private static final int MODE_MAKEUP = 2; - 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 mTsMakeupSwitcher; @@ -110,7 +110,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 static final int CLICK_THRESHOLD = 200; private int previewMenuSize; @@ -1293,27 +1293,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( @@ -1329,6 +1308,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 82d8c8afc..cd0f85102 100644 --- a/src/com/android/camera/VideoMenu.java +++ b/src/com/android/camera/VideoMenu.java @@ -21,7 +21,9 @@ import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.content.Context; import android.content.res.Resources; +import android.content.SharedPreferences; import android.graphics.Rect; +import android.preference.PreferenceManager; import android.text.TextUtils; import android.view.Display; import android.view.LayoutInflater; @@ -73,6 +75,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; @@ -82,6 +85,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 static final int CLICK_THRESHOLD = 200; private int previewMenuSize; @@ -576,6 +580,7 @@ public class VideoMenu extends MenuController LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( Context.LAYOUT_INFLATER_SERVICE); + FrameLayout basic = (FrameLayout) inflater.inflate( gridRes, null, false); @@ -823,7 +828,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); @@ -836,6 +840,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