From 41d18fed018678492323150c661f2b9f6c8931a8 Mon Sep 17 00:00:00 2001 From: Byunghun Jeon Date: Mon, 16 Jun 2014 17:42:26 -0700 Subject: SnapdragonCamera: Modify SnapdragonCamera UI Modified SnapdragonCamera setting menus with new icons Change-Id: I726296dfb100ac81ad6f1cd84420ae27c0ae1201 --- src/com/android/camera/PreviewGestures.java | 87 +++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'src/com/android/camera/PreviewGestures.java') diff --git a/src/com/android/camera/PreviewGestures.java b/src/com/android/camera/PreviewGestures.java index 91f567530..f4f8296ab 100644 --- a/src/com/android/camera/PreviewGestures.java +++ b/src/com/android/camera/PreviewGestures.java @@ -21,6 +21,8 @@ import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; +import com.android.camera.CustomPhotoMenu; +import com.android.camera.CustomVideoMenu; import com.android.camera.ui.PieRenderer; import com.android.camera.ui.RenderOverlay; import com.android.camera.ui.ZoomRenderer; @@ -54,6 +56,10 @@ public class PreviewGestures private boolean mEnabled; private boolean mZoomOnly; private GestureDetector mGestureDetector; + private CustomPhotoMenu mCustomPhotoMenu; + private CustomVideoMenu mCustomVideoMenu; + private boolean waitUntilNextDown; + private boolean setToFalse; private GestureDetector.SimpleOnGestureListener mGestureListener = new GestureDetector.SimpleOnGestureListener() { @Override @@ -90,6 +96,23 @@ public class PreviewGestures return true; } } + + if (deltaX < 0 && Math.abs(deltaX) > 2 * Math.abs(deltaY)) { + // Open menu on swipe left + waitUntilNextDown = true; + if (mCustomPhotoMenu != null) { + if (!mCustomPhotoMenu.isMenuBeingShown()) { + mCustomPhotoMenu.openFirstLevel(); + } + } + + if (mCustomVideoMenu != null) { + if (!mCustomVideoMenu.isMenuBeingShown()) { + mCustomVideoMenu.openFirstLevel(); + } + } + return true; + } return false; } }; @@ -129,7 +152,36 @@ public class PreviewGestures return mEnabled; } + public void setCustomPhotoMenu(CustomPhotoMenu menu) { + mCustomPhotoMenu = menu; + } + + public void setCustomVideoMenu(CustomVideoMenu menu) { + mCustomVideoMenu = menu; + } + + public CustomPhotoMenu getCustomPhotoMenu() { + return mCustomPhotoMenu; + } + + public CustomVideoMenu getCustomVideoMenu() { + return mCustomVideoMenu; + } + public boolean dispatchTouch(MotionEvent m) { + if (setToFalse) { + waitUntilNextDown = false; + setToFalse = false; + } + if (waitUntilNextDown) { + if (MotionEvent.ACTION_UP != m.getActionMasked() + && MotionEvent.ACTION_CANCEL != m.getActionMasked()) + return true; + else { + setToFalse = true; + return true; + } + } if (!mEnabled) { return false; } @@ -144,6 +196,37 @@ public class PreviewGestures return sendToPie(m); } + if (mCustomPhotoMenu != null) { + if (mCustomPhotoMenu.isMenuBeingShown()) { + if (!mCustomPhotoMenu.isMenuBeingAnimated()) { + waitUntilNextDown = true; + mCustomPhotoMenu.closeView(); + } + return true; + } + if (mCustomPhotoMenu.isPreviewMenuBeingShown()) { + waitUntilNextDown = true; + mCustomPhotoMenu.animateSlideOutPreviewMenu(); + return true; + } + } + + if (mCustomVideoMenu != null) { + if (mCustomVideoMenu.isMenuBeingShown()) { + if (!mCustomVideoMenu.isMenuBeingAnimated()) { + waitUntilNextDown = true; + mCustomVideoMenu.closeView(); + } + return true; + } + + if (mCustomVideoMenu.isPreviewMenuBeingShown()) { + waitUntilNextDown = true; + mCustomVideoMenu.animateSlideOutPreviewMenu(); + return true; + } + } + // If pie is not open, send touch events to gesture detector and scale // listener to recognize the gesture. mGestureDetector.onTouchEvent(m); @@ -162,6 +245,10 @@ public class PreviewGestures return true; } + public boolean waitUntilNextDown() { + return waitUntilNextDown; + } + private MotionEvent makeCancelEvent(MotionEvent m) { MotionEvent c = MotionEvent.obtain(m); c.setAction(MotionEvent.ACTION_CANCEL); -- cgit v1.2.3