summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjt1134 <jt1134@gmail.com>2013-01-12 00:35:45 -0600
committerMichael Bestas <mikeioannina@gmail.com>2015-09-20 20:02:05 +0300
commit8062e0b048dfe8604b7e4f2ba30c0f0aaaf24a0b (patch)
tree7db8280e8c8bb4c3544a53d513a3355ec5759eb8
parent71f4fae6ca8c12c467b5afa8a6d325fc10b77f45 (diff)
downloadandroid_packages_apps_Snap-8062e0b048dfe8604b7e4f2ba30c0f0aaaf24a0b.zip
android_packages_apps_Snap-8062e0b048dfe8604b7e4f2ba30c0f0aaaf24a0b.tar.gz
android_packages_apps_Snap-8062e0b048dfe8604b7e4f2ba30c0f0aaaf24a0b.tar.bz2
Snap: Add touch-to-focus timeout duration settings
Signed-off-by: Michael Bestas <mikeioannina@gmail.com> Change-Id: Ib2c2c152a52b2616dd0da6f071f572d34fe64065
-rw-r--r--res/values/cm_arrays.xml20
-rw-r--r--res/values/cm_strings.xml11
-rw-r--r--res/xml/camera_preferences.xml6
-rw-r--r--src/com/android/camera/CameraSettings.java1
-rw-r--r--src/com/android/camera/FocusOverlayManager.java17
-rw-r--r--src/com/android/camera/PhotoMenu.java2
-rw-r--r--src/com/android/camera/PhotoModule.java5
7 files changed, 57 insertions, 5 deletions
diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml
index b308c08..94410cf 100644
--- a/res/values/cm_arrays.xml
+++ b/res/values/cm_arrays.xml
@@ -24,4 +24,24 @@
<item>@string/setting_off</item>
<item>@string/setting_on</item>
</array>
+
+ <!-- Touch focus duration -->
+ <string-array name="pref_camera_focustime_duration_entries" translatable="false">
+ <item>@string/pref_camera_focustime_entry_5</item>
+ <item>@string/pref_camera_focustime_entry_10</item>
+ <item>@string/pref_camera_focustime_entry_15</item>
+ <item>@string/pref_camera_focustime_entry_20</item>
+ <item>@string/pref_camera_focustime_entry_30</item>
+ <item>@string/pref_camera_focustime_entry_infinite</item>
+ </string-array>
+
+ <!-- Stored in milliseconds -->
+ <string-array name="pref_camera_focustime_duration_values" translatable="false">
+ <item>5000</item>
+ <item>10000</item>
+ <item>15000</item>
+ <item>20000</item>
+ <item>30000</item>
+ <item>0</item>
+ </string-array>
</resources>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 0a97751..b328bda 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -150,4 +150,15 @@
<!-- Max brightness -->
<string name="pref_camera_max_brightness_title">Bright screen</string>
<string name="pref_camera_max_brightness_default" translatable="false">off</string>
+
+ <!-- Touch focus duration -->
+ <string name="pref_camera_focustime_title">Touch focus duration</string>
+ <string name="pref_camera_focustime_default" translatable="false">5000</string>
+
+ <string name="pref_camera_focustime_entry_5">5s</string>
+ <string name="pref_camera_focustime_entry_10">10s</string>
+ <string name="pref_camera_focustime_entry_15">15s</string>
+ <string name="pref_camera_focustime_entry_20">20s</string>
+ <string name="pref_camera_focustime_entry_30">30s</string>
+ <string name="pref_camera_focustime_entry_infinite">Infinite</string>
</resources>
diff --git a/res/xml/camera_preferences.xml b/res/xml/camera_preferences.xml
index 54d7242..2fb598e 100644
--- a/res/xml/camera_preferences.xml
+++ b/res/xml/camera_preferences.xml
@@ -74,6 +74,12 @@
camera:entries="@array/pref_camera_focusmode_entries"
camera:labelList="@array/pref_camera_focusmode_labels"
camera:entryValues="@array/pref_camera_focusmode_entryvalues" />
+ <ListPreference
+ camera:key="pref_camera_focustime_key"
+ camera:defaultValue="@string/pref_camera_focustime_default"
+ camera:title="@string/pref_camera_focustime_title"
+ camera:entries="@array/pref_camera_focustime_duration_entries"
+ camera:entryValues="@array/pref_camera_focustime_duration_values" />
<ListPreference
camera:key="pref_camera_ae_bracket_hdr_key"
camera:defaultValue="@string/pref_camera_ae_bracket_hdr_default"
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index a877455..b27041c 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -61,6 +61,7 @@ public class CameraSettings {
public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
+ public static final String KEY_FOCUS_TIME = "pref_camera_focustime_key";
public static final String KEY_FLASH_MODE = "pref_camera_flashmode_key";
public static final String KEY_VIDEOCAMERA_FLASH_MODE = "pref_camera_video_flashmode_key";
public static final String KEY_WHITE_BALANCE = "pref_camera_whitebalance_key";
diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java
index c5ffef5..3b0ef27 100644
--- a/src/com/android/camera/FocusOverlayManager.java
+++ b/src/com/android/camera/FocusOverlayManager.java
@@ -60,7 +60,6 @@ public class FocusOverlayManager {
private static final String TAG = "CAM_FocusManager";
private static final int RESET_TOUCH_FOCUS = 0;
- private static final int RESET_TOUCH_FOCUS_DELAY = 3000;
private int mState = STATE_IDLE;
public static final int STATE_IDLE = 0; // Focus is not active.
@@ -107,6 +106,8 @@ public class FocusOverlayManager {
public void resumeFaceDetection();
}
+ private int mFocusTime; // time after touch-to-focus
+
public interface Listener {
public void autoFocus();
public void cancelAutoFocus();
@@ -272,6 +273,11 @@ public class FocusOverlayManager {
}
}
+ // set touch-to-focus duration
+ public void setFocusTime(int time) {
+ mFocusTime = time;
+ }
+
public void onAutoFocus(boolean focused, boolean shutterButtonPressed) {
if (mState == STATE_FOCUSING_SNAP_ON_FINISH) {
// Take the picture no matter focus succeeds or fails. No need
@@ -296,8 +302,8 @@ public class FocusOverlayManager {
updateFocusUI();
// If this is triggered by touch focus, cancel focus after a
// while.
- if (mFocusArea != null) {
- mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY);
+ if ((mFocusArea != null) && (mFocusTime != 0)) {
+ mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, mFocusTime);
}
if (shutterButtonPressed) {
// Lock AE & AWB so users can half-press shutter and recompose.
@@ -404,9 +410,10 @@ public class FocusOverlayManager {
autoFocus();
} else { // Just show the indicator in all other cases.
updateFocusUI();
- // Reset the metering area in 3 seconds.
mHandler.removeMessages(RESET_TOUCH_FOCUS);
- mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY);
+ if (mFocusTime != 0) {
+ mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, mFocusTime);
+ }
}
}
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index ab4c446..37aa77f 100644
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -149,6 +149,7 @@ public class PhotoMenu extends MenuController
CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_FOCUS_MODE,
+ CameraSettings.KEY_FOCUS_TIME,
CameraSettings.KEY_REDEYE_REDUCTION,
CameraSettings.KEY_POWER_SHUTTER,
CameraSettings.KEY_MAX_BRIGHTNESS
@@ -167,6 +168,7 @@ public class PhotoMenu extends MenuController
CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_FOCUS_MODE,
+ CameraSettings.KEY_FOCUS_TIME,
CameraSettings.KEY_REDEYE_REDUCTION,
CameraSettings.KEY_POWER_SHUTTER,
CameraSettings.KEY_MAX_BRIGHTNESS,
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 6e2838f..f67200f 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -3581,6 +3581,11 @@ public class PhotoModule
mFocusManager.overrideFocusMode(null);
mParameters.setFocusMode(mFocusManager.getFocusMode());
}
+
+ // Set focus time.
+ mFocusManager.setFocusTime(Integer.valueOf(
+ mPreferences.getString(CameraSettings.KEY_FOCUS_TIME,
+ mActivity.getString(R.string.pref_camera_focustime_default))));
} else {
mFocusManager.overrideFocusMode(mParameters.getFocusMode());
if (hdrOn)