summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriele M <moto.falcon.git@gmail.com>2017-04-04 18:05:25 +0200
committerDaniel Hillenbrand <daniel.hillenbrand@codeworkx.de>2017-04-10 17:05:41 +0000
commit7e10f005f68bda44fbaaa9120ae7cd6e8442844c (patch)
tree35b30075bee17067f168a67c82e9fd994c153e1d
parent30ba5582237ad86126e08cb55b6d1cff96de5ffa (diff)
downloadandroid_packages_apps_Snap-7e10f005f68bda44fbaaa9120ae7cd6e8442844c.zip
android_packages_apps_Snap-7e10f005f68bda44fbaaa9120ae7cd6e8442844c.tar.gz
android_packages_apps_Snap-7e10f005f68bda44fbaaa9120ae7cd6e8442844c.tar.bz2
Never remove unsupported controls
Different cameras support different features. If we remove certain controls because the current camera doesn't support them, they won't be available for the other camera once we switch to it, even if it supports them. Disable the controls instead of removing them. This completes commit a8285adbba49868378f795a6f37401b9334061c4 ("Snap: Fix effect and picture program overlay buttons") and also changes the way buttons are hidden so that each button stays in its initial position. Change-Id: I7af9655265163b00495af5aa0bb745aa4cc1ed47
-rw-r--r--src/com/android/camera/PhotoMenu.java23
-rw-r--r--src/com/android/camera/VideoMenu.java6
2 files changed, 15 insertions, 14 deletions
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 9b26b81..fccea69 100644
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -160,17 +160,13 @@ public class PhotoMenu extends MenuController
initFilterModeButton(mFilterModeSwitcher);
if (TsMakeupManager.HAS_TS_MAKEUP) {
if (initMakeupModeButton(mTsMakeupSwitcher)) {
- mUI.removeControlView(mHdrSwitcher);
+ mHdrSwitcher.setVisibility(View.INVISIBLE);
}
}
if(!TsMakeupManager.HAS_TS_MAKEUP) {
// HDR.
- if (group.findPreference(CameraSettings.KEY_CAMERA_HDR) != null) {
- initSwitchItem(CameraSettings.KEY_CAMERA_HDR, mHdrSwitcher);
- } else {
- mUI.removeControlView(mHdrSwitcher);
- }
+ initSwitchItem(CameraSettings.KEY_CAMERA_HDR, mHdrSwitcher);
}
mOtherKeys1 = new String[] {
@@ -756,9 +752,10 @@ public class PhotoMenu extends MenuController
final IconListPreference pref =
(IconListPreference) mPreferenceGroup.findPreference(prefKey);
if (pref == null) {
- mUI.removeControlView(switcher);
+ switcher.setVisibility(View.INVISIBLE);
return;
}
+ switcher.setVisibility(View.VISIBLE);
int[] iconIds = pref.getLargeIconIds();
int resid = -1;
@@ -809,9 +806,10 @@ public class PhotoMenu extends MenuController
final IconListPreference pref = (IconListPreference) mPreferenceGroup
.findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE);
if (pref == null) {
- mUI.removeControlView(button);
+ button.setVisibility(View.INVISIBLE);
return false;
}
+ button.setVisibility(View.VISIBLE);
int[] iconIds = pref.getLargeIconIds();
int resid = -1;
@@ -901,7 +899,7 @@ public class PhotoMenu extends MenuController
final IconListPreference pref = (IconListPreference) mPreferenceGroup
.findPreference(CameraSettings.KEY_SCENE_MODE);
if (pref == null) {
- button.setVisibility(View.GONE);
+ button.setVisibility(View.INVISIBLE);
return;
}
button.setVisibility(View.VISIBLE);
@@ -1045,7 +1043,7 @@ public class PhotoMenu extends MenuController
final IconListPreference pref = (IconListPreference) mPreferenceGroup
.findPreference(CameraSettings.KEY_COLOR_EFFECT);
if (pref == null || pref.getValue() == null) {
- button.setVisibility(View.GONE);
+ button.setVisibility(View.INVISIBLE);
return;
}
button.setVisibility(View.VISIBLE);
@@ -1421,11 +1419,12 @@ public class PhotoMenu extends MenuController
ListPreference autoHdrPref = mPreferenceGroup.findPreference(CameraSettings.KEY_AUTO_HDR);
if (autoHdrPref == null) {
- mHdrSwitcher.setVisibility(View.GONE);
- mUI.getCameraControls().removeFromViewList(mHdrSwitcher);
+ mHdrSwitcher.setVisibility(View.INVISIBLE);
} else if (autoHdrPref.getValue().equalsIgnoreCase("enable")) {
+ mHdrSwitcher.setVisibility(View.VISIBLE);
mHdrSwitcher.setEnabled(false);
} else {
+ mHdrSwitcher.setVisibility(View.VISIBLE);
mHdrSwitcher.setEnabled(true);
}
updateFilterModeIcon(pref, pref);
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index cb9d03f..1ac3677 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -426,9 +426,10 @@ public class VideoMenu extends MenuController
final IconListPreference pref =
(IconListPreference) mPreferenceGroup.findPreference(prefKey);
if (pref == null) {
- mUI.removeControlView(switcher);
+ switcher.setVisibility(View.INVISIBLE);
return;
}
+ switcher.setVisibility(View.VISIBLE);
int[] iconIds = pref.getLargeIconIds();
int resid = -1;
@@ -470,9 +471,10 @@ public class VideoMenu extends MenuController
final IconListPreference pref = (IconListPreference) mPreferenceGroup
.findPreference(CameraSettings.KEY_VIDEOCAMERA_COLOR_EFFECT);
if (pref == null || pref.getValue() == null) {
- mUI.removeControlView(button);
+ button.setVisibility(View.INVISIBLE);
return;
}
+ button.setVisibility(View.VISIBLE);
changeFilterModeControlIcon(pref.getValue());
button.setOnClickListener(new OnClickListener() {