diff options
-rw-r--r-- | src/com/android/camera/Camera.java | 15 | ||||
-rw-r--r-- | src/com/android/camera/ImageViewTouchBase.java | 21 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 16 |
3 files changed, 36 insertions, 16 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index a691319..b7f09bf 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -1178,14 +1178,17 @@ public class Camera extends Activity implements View.OnClickListener, } @Override + public void onBackPressed() { + if (!isCameraIdle()) { + // ignore backs while we're taking a picture + return; + } + super.onBackPressed(); + } + + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { - case KeyEvent.KEYCODE_BACK: - if (!isCameraIdle()) { - // ignore backs while we're taking a picture - return true; - } - break; case KeyEvent.KEYCODE_FOCUS: if (mFirstTimeInitialized && event.getRepeatCount() == 0) { doFocus(true); diff --git a/src/com/android/camera/ImageViewTouchBase.java b/src/com/android/camera/ImageViewTouchBase.java index d58d48e..0cab8fc 100644 --- a/src/com/android/camera/ImageViewTouchBase.java +++ b/src/com/android/camera/ImageViewTouchBase.java @@ -92,15 +92,28 @@ abstract class ImageViewTouchBase extends ImageView { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK && getScale() > 1.0f) { - // If we're zoomed in, pressing Back jumps out to show the entire - // image, otherwise Back returns the user to the gallery. - zoomTo(1.0f); + if (keyCode == KeyEvent.KEYCODE_BACK + && event.getRepeatCount() == 0) { + event.startTracking(); return true; } return super.onKeyDown(keyCode, event); } + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking() + && !event.isCanceled()) { + if (getScale() > 1.0f) { + // If we're zoomed in, pressing Back jumps out to show the + // entire image, otherwise Back returns the user to the gallery. + zoomTo(1.0f); + return true; + } + } + return super.onKeyUp(keyCode, event); + } + protected Handler mHandler = new Handler(); protected int mLastXTouchPos; diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 3809517..167356d 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -656,6 +656,16 @@ public class VideoCamera extends Activity implements View.OnClickListener, } @Override + public void onBackPressed() { + if (mPausing) return; + if (mMediaRecorderRecording) { + mShutterButton.performClick(); + return; + } + super.onBackPressed(); + } + + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // Do not handle any key if the activity is paused. if (mPausing) { @@ -663,12 +673,6 @@ public class VideoCamera extends Activity implements View.OnClickListener, } switch (keyCode) { - case KeyEvent.KEYCODE_BACK: - if (mMediaRecorderRecording) { - mShutterButton.performClick(); - return true; - } - break; case KeyEvent.KEYCODE_CAMERA: if (event.getRepeatCount() == 0) { mShutterButton.performClick(); |