summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-08-03 15:40:15 -0700
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 22:00:38 +0200
commit2b57b443f4f281d066a6f3b6a150ceb3d670c45a (patch)
tree5d5a367825f29ceef6e4c581759c63db531c1717
parentbb9ab5d65643e312d320288fae9a174a1e2ac86d (diff)
downloadandroid_packages_apps_Snap-2b57b443f4f281d066a6f3b6a150ceb3d670c45a.zip
android_packages_apps_Snap-2b57b443f4f281d066a6f3b6a150ceb3d670c45a.tar.gz
android_packages_apps_Snap-2b57b443f4f281d066a6f3b6a150ceb3d670c45a.tar.bz2
snap: Fixes for advanced features and scene modes
* Get rid of the annoying toast when longshot is disabled * Add support for ChromaFlash as a scene mode * Adjust overrides for various scene modes Change-Id: Ifda1990f4e9b3435655664f2a6c2b31fc3ae23fa
-rw-r--r--src/com/android/camera/CameraSettings.java21
-rwxr-xr-xsrc/com/android/camera/PhotoMenu.java7
-rwxr-xr-xsrc/com/android/camera/PhotoModule.java67
3 files changed, 54 insertions, 41 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index f5963f8..ccf374e 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -1045,7 +1045,7 @@ public class CameraSettings {
if (chromaFlash != null) {
List<String> supportedAdvancedFeatures =
getSupportedAdvancedFeatures(mParameters);
- if (!CameraUtil.isSupported(
+ if (hasChromaFlashScene(mContext) || !CameraUtil.isSupported(
mContext.getString(R.string
.pref_camera_advanced_feature_value_chromaflash_on),
supportedAdvancedFeatures)) {
@@ -1071,6 +1071,13 @@ public class CameraSettings {
supportedSceneModes.add(mContext.getString(R.string
.pref_camera_advanced_feature_value_optizoom_on));
}
+ if (hasChromaFlashScene(mContext) && CameraUtil.isSupported(
+ mContext.getString(R.string
+ .pref_camera_advanced_feature_value_chromaflash_on),
+ supportedAdvancedFeatures)) {
+ supportedSceneModes.add(mContext.getString(R.string
+ .pref_camera_advanced_feature_value_chromaflash_on));
+ }
filterUnsupportedOptions(group, sceneMode, supportedSceneModes);
}
if (flashMode != null) {
@@ -1749,4 +1756,16 @@ public class CameraSettings {
pictureSize.setEntries(entries.toArray(new String[entries.size()]));
pictureSize.setEntryValues(entryValues.toArray(new String[entryValues.size()]));
}
+
+ public static boolean hasChromaFlashScene(Context context) {
+ String[] sceneModes = context.getResources().getStringArray(
+ R.array.pref_camera_scenemode_entryvalues);
+ for (String mode : sceneModes) {
+ if (mode.equals(context.getResources().getString(R.string
+ .pref_camera_advanced_feature_value_chromaflash_on))) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 8d77307..38a81c8 100755
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -1480,13 +1480,12 @@ public class PhotoMenu extends MenuController
}
}
- String chromaFlashOn = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_chromaflash_on);
- if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)) {
+ String chromaFlashOn = mActivity.getString(R.string
+ .pref_camera_advanced_feature_value_chromaflash_on);
+ if (notSame(pref, CameraSettings.KEY_SCENE_MODE, chromaFlashOn)) {
ListPreference lp = mPreferenceGroup
.findPreference(CameraSettings.KEY_ADVANCED_FEATURES);
if (lp != null && chromaFlashOn.equals(lp.getValue())) {
- setPreference(CameraSettings.KEY_QC_CHROMA_FLASH, mSettingOff);
setPreference(CameraSettings.KEY_ADVANCED_FEATURES,
mActivity.getString(R.string.pref_camera_advanced_feature_default));
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index dffd98b..10f6580 100755
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1983,8 +1983,10 @@ public class PhotoModule
(fssr != null && fssr.equals(fssrOn)) ||
(truePortrait != null && truePortrait.equals(truPortraitOn)) ||
(stillMore != null && stillMore.equals(stillMoreOn))) {
- if ( (optiZoom != null && optiZoom.equals(optiZoomOn)) ||
- (reFocus != null && reFocus.equals(reFocusOn)) ) {
+ if ((optiZoom != null && optiZoom.equals(optiZoomOn)) ||
+ (reFocus != null && reFocus.equals(reFocusOn)) ||
+ (CameraSettings.hasChromaFlashScene(mActivity) &&
+ chromaFlash != null && chromaFlash.equals(chromaFlashOn))) {
sceneMode = null;
} else {
mSceneMode = sceneMode = Parameters.SCENE_MODE_AUTO;
@@ -2008,7 +2010,9 @@ public class PhotoModule
// If scene mode is set, for white balance and focus mode
// read settings from preferences so we retain user preferences.
- if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) {
+ if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode) &&
+ !"asd".equals(mSceneMode) &&
+ !"sports".equals(mSceneMode)) {
flashMode = mParameters.FLASH_MODE_OFF;
String whiteBalance = Parameters.WHITE_BALANCE_AUTO;
focusMode = mFocusManager.getFocusMode(false);
@@ -2059,6 +2063,12 @@ public class PhotoModule
flashMode = Parameters.FLASH_MODE_OFF;
mParameters.setFlashMode(flashMode);
}
+
+ if (chromaFlash != null && chromaFlash.equals(chromaFlashOn)) {
+ flashMode = Parameters.FLASH_MODE_ON;
+ mParameters.setFlashMode(flashMode);
+ }
+
if (disableLongShot) {
mUI.overrideSettings(CameraSettings.KEY_LONGSHOT,
mActivity.getString(R.string.setting_off_value));
@@ -3992,6 +4002,9 @@ public class PhotoModule
.pref_camera_advanced_feature_value_refocus_on);
String optizoomOn = mActivity.getString(R.string
.pref_camera_advanced_feature_value_optizoom_on);
+ String chromaFlashOn = mActivity.getString(R.string
+ .pref_camera_advanced_feature_value_chromaflash_on);
+
if (refocusOn.equals(mSceneMode)) {
try {
mSceneMode = Parameters.SCENE_MODE_AUTO;
@@ -4009,6 +4022,12 @@ public class PhotoModule
}
} catch (NullPointerException e) {
}
+ } else if (chromaFlashOn.equals(mSceneMode)) {
+ try {
+ mUI.setPreference(CameraSettings.KEY_ADVANCED_FEATURES, chromaFlashOn);
+ mParameters.setSceneMode(Parameters.SCENE_MODE_AUTO);
+ } catch (NullPointerException e) {
+ }
} else if (mSceneMode == null) {
mSceneMode = Parameters.SCENE_MODE_AUTO;
}
@@ -4062,7 +4081,9 @@ public class PhotoModule
Log.w(TAG, "invalid exposure range: " + value);
}
- if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) {
+ if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode) ||
+ "asd".equals(mSceneMode) ||
+ "sports".equals(mSceneMode)) {
// Set flash mode.
String flashMode;
if (mSavedFlashMode == null) {
@@ -4116,9 +4137,11 @@ public class PhotoModule
mActivity.getString(R.string.pref_camera_focustime_default))));
} else {
mFocusManager.overrideFocusMode(mParameters.getFocusMode());
- if (CameraUtil.isSupported(Parameters.FLASH_MODE_OFF,
+ String flashMode = chromaFlashOn.equals(mSceneMode) ?
+ Parameters.FLASH_MODE_ON : Parameters.FLASH_MODE_OFF;
+ if (CameraUtil.isSupported(flashMode,
mParameters.getSupportedFlashModes())) {
- mParameters.setFlashMode(Parameters.FLASH_MODE_OFF);
+ mParameters.setFlashMode(flashMode);
}
if (CameraUtil.isSupported(Parameters.WHITE_BALANCE_AUTO,
mParameters.getSupportedWhiteBalance())) {
@@ -4763,39 +4786,11 @@ public class PhotoModule
updateRemainingPhotos();
}
- if (CameraSettings.KEY_QC_CHROMA_FLASH.equals(pref.getKey())) {
+ if (!CameraSettings.hasChromaFlashScene(mActivity) &&
+ CameraSettings.KEY_QC_CHROMA_FLASH.equals(pref.getKey())) {
mUI.setPreference(CameraSettings.KEY_ADVANCED_FEATURES, pref.getValue());
}
- String ubiFocusOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_ubifocus_off);
- String chromaFlashOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_chromaflash_off);
- String optiZoomOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_optizoom_off);
- String reFocusOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_refocus_off);
- String fssrOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_FSSR_off);
- String truePortraitOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_trueportrait_off);
- String multiTouchFocusOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_multi_touch_focus_off);
- String stillMoreOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_stillmore_off);
- String advancedFeatureOff = mActivity.getString(R.string.
- pref_camera_advanced_feature_value_none);
- if (notSame(pref, CameraSettings.KEY_QC_OPTI_ZOOM, optiZoomOff) ||
- notSame(pref, CameraSettings.KEY_QC_AF_BRACKETING, ubiFocusOff) ||
- notSame(pref, CameraSettings.KEY_QC_FSSR, fssrOff) ||
- notSame(pref, CameraSettings.KEY_QC_TP, truePortraitOff) ||
- notSame(pref, CameraSettings.KEY_QC_MULTI_TOUCH_FOCUS, multiTouchFocusOff) ||
- notSame(pref, CameraSettings.KEY_QC_STILL_MORE, stillMoreOff) ||
- notSame(pref, CameraSettings.KEY_QC_RE_FOCUS, reFocusOff) ||
- notSame(pref, CameraSettings.KEY_ADVANCED_FEATURES, advancedFeatureOff)) {
- RotateTextToast.makeText(mActivity, R.string.advanced_capture_disable_continuous_shot,
- Toast.LENGTH_LONG).show();
- }
//call generic onSharedPreferenceChanged
onSharedPreferenceChanged();
}