summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Automerger <android-build@android.com>2011-11-02 20:59:11 -0700
committerThe Android Automerger <android-build@android.com>2011-11-02 20:59:11 -0700
commita067233f2464ef6ad59e5805c7cd1c334bcd1c08 (patch)
tree66860027070650f8224fb9c18f2c7a1187cee6de
parent03006c894b6f8931dbd45ffe492f158123b18e20 (diff)
downloadpackages_apps_LegacyCamera-a067233f2464ef6ad59e5805c7cd1c334bcd1c08.zip
packages_apps_LegacyCamera-a067233f2464ef6ad59e5805c7cd1c334bcd1c08.tar.gz
packages_apps_LegacyCamera-a067233f2464ef6ad59e5805c7cd1c334bcd1c08.tar.bz2
Revert "Merge "Remove long pressing shutter triggers autocous." into ics-mr0"
This reverts commit 4d55f6cb82c07a6191d2ab8e78fbab8c31e9db89, reversing changes made to 174b8b7fc4d55e8c63eb3ed0b71f1519a13e345d.
-rw-r--r--src/com/android/camera/Camera.java12
-rw-r--r--src/com/android/camera/FocusManager.java23
-rwxr-xr-xsrc/com/android/camera/ShutterButton.java23
3 files changed, 55 insertions, 3 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 8898510..1bedb4f 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -82,7 +82,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
View.OnTouchListener, ShutterButton.OnShutterButtonListener,
SurfaceHolder.Callback, ModePicker.OnModeChangeListener,
FaceDetectionListener, CameraPreference.OnPreferenceChangedListener,
- LocationManager.Listener {
+ LocationManager.Listener, ShutterButton.OnShutterButtonLongPressListener {
private static final String TAG = "camera";
@@ -370,6 +370,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
// Initialize shutter button.
mShutterButton = (ShutterButton) findViewById(R.id.shutter_button);
mShutterButton.setOnShutterButtonListener(this);
+ mShutterButton.setOnShutterButtonLongPressListener(this);
mShutterButton.setVisibility(View.VISIBLE);
// Initialize focus UI.
@@ -1392,6 +1393,15 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
mFocusManager.doSnap();
}
+ @Override
+ public void onShutterButtonLongPressed() {
+ if (mPausing || mCameraState == SNAPSHOT_IN_PROGRESS
+ || mCameraDevice == null || mPicturesRemaining <= 0) return;
+
+ Log.v(TAG, "onShutterButtonLongPressed");
+ mFocusManager.shutterLongPressed();
+ }
+
private OnScreenHint mStorageHint;
private void updateStorageHint() {
diff --git a/src/com/android/camera/FocusManager.java b/src/com/android/camera/FocusManager.java
index 72ea8b5..86b92c2 100644
--- a/src/com/android/camera/FocusManager.java
+++ b/src/com/android/camera/FocusManager.java
@@ -56,6 +56,7 @@ public class FocusManager {
private boolean mInitialized;
private boolean mFocusAreaSupported;
+ private boolean mInLongPress;
private boolean mLockAeAwbNeeded;
private boolean mAeAwbLock;
private Matrix mMatrix;
@@ -173,6 +174,22 @@ public class FocusManager {
}
}
+ public void shutterLongPressed() {
+ if (Parameters.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusMode)
+ && isSupported(Parameters.FOCUS_MODE_AUTO, mParameters.getSupportedFocusModes())) {
+ if (mState == STATE_IDLE || mState == STATE_FOCUSING_SNAP_ON_FINISH) {
+ Log.e(TAG, "Invalid focus state=" + mState);
+ }
+ mInLongPress = true;
+ // Cancel any outstanding Auto focus requests. The auto focus mode
+ // will be changed from CAF to auto in cancelAutoFocus.
+ onShutterUp();
+ // Call Autofocus
+ onShutterDown();
+ mInLongPress = false;
+ }
+ }
+
public void doSnap() {
if (!mInitialized) return;
@@ -362,7 +379,11 @@ public class FocusManager {
public String getFocusMode() {
if (mOverrideFocusMode != null) return mOverrideFocusMode;
- if (mFocusAreaSupported && mFocusArea != null) {
+ if (mInLongPress) {
+ // Users long-press the shutter button in CAF. Change it to auto
+ // mode, so it will do a full scan.
+ mFocusMode = Parameters.FOCUS_MODE_AUTO;
+ } else if (mFocusAreaSupported && mFocusArea != null) {
// Always use autofocus in tap-to-focus.
mFocusMode = Parameters.FOCUS_MODE_AUTO;
} else {
diff --git a/src/com/android/camera/ShutterButton.java b/src/com/android/camera/ShutterButton.java
index c7f792a..ace154e 100755
--- a/src/com/android/camera/ShutterButton.java
+++ b/src/com/android/camera/ShutterButton.java
@@ -26,7 +26,7 @@ import android.widget.ImageView;
* It's currently an {@code ImageView} that can call a delegate when the
* pressed state changes.
*/
-public class ShutterButton extends ImageView {
+public class ShutterButton extends ImageView implements View.OnLongClickListener {
/**
* A callback to be invoked when a ShutterButton's pressed state changes.
*/
@@ -40,17 +40,30 @@ public class ShutterButton extends ImageView {
void onShutterButtonClick();
}
+ /**
+ * A callback to be invoked when a ShutterButton's long pressed.
+ */
+ public interface OnShutterButtonLongPressListener {
+ void onShutterButtonLongPressed();
+ }
+
private OnShutterButtonListener mListener;
+ private OnShutterButtonLongPressListener mLongPressListener;
private boolean mOldPressed;
public ShutterButton(Context context, AttributeSet attrs) {
super(context, attrs);
+ setOnLongClickListener(this);
}
public void setOnShutterButtonListener(OnShutterButtonListener listener) {
mListener = listener;
}
+ public void setOnShutterButtonLongPressListener(OnShutterButtonLongPressListener listener) {
+ mLongPressListener = listener;
+ }
+
/**
* Hook into the drawable state changing to get changes to isPressed -- the
* onPressed listener doesn't always get called when the pressed state
@@ -109,4 +122,12 @@ public class ShutterButton extends ImageView {
}
return result;
}
+
+ @Override
+ public boolean onLongClick(View v) {
+ if (mLongPressListener != null) {
+ mLongPressListener.onShutterButtonLongPressed();
+ }
+ return false;
+ }
}