From f4868aefa68f52621b2fe49429adf7d165e8d9c9 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Sun, 27 Aug 2017 15:55:27 +0200 Subject: [PATCH] Fix vertical scrolls, removed some logs (#7) --- .../java/com/otaliastudios/cameraview/CameraView.java | 10 +++++----- .../otaliastudios/cameraview/ScrollGestureLayout.java | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index 8450ce9a..471eee2d 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -412,13 +412,13 @@ public class CameraView extends FrameLayout { // Pass to our own GestureLayouts CameraOptions options = mCameraController.getCameraOptions(); // Non null if (mPinchGestureLayout.onTouchEvent(event)) { - Log.e(TAG, "pinch!"); + // Log.e(TAG, "pinch!"); onGesture(mPinchGestureLayout, options); } else if (mScrollGestureLayout.onTouchEvent(event)) { - Log.e(TAG, "scroll!"); + // Log.e(TAG, "scroll!"); onGesture(mScrollGestureLayout, options); } else if (mTapGestureLayout.onTouchEvent(event)) { - Log.e(TAG, "tap!"); + // Log.e(TAG, "tap!"); onGesture(mTapGestureLayout, options); } return true; @@ -1252,8 +1252,8 @@ public class CameraView extends FrameLayout { int w = consistentWithView ? getWidth() : getHeight(); int h = consistentWithView ? getHeight() : getWidth(); AspectRatio targetRatio = AspectRatio.of(w, h); - Log.e(TAG, "is Consistent? " + consistentWithView); - Log.e(TAG, "viewWidth? " + getWidth() + ", viewHeight? " + getHeight()); + // Log.e(TAG, "is Consistent? " + consistentWithView); + // Log.e(TAG, "viewWidth? " + getWidth() + ", viewHeight? " + getHeight()); jpeg2 = CropHelper.cropToJpeg(jpeg, targetRatio, mJpegQuality); } dispatchOnPictureTaken(jpeg2); diff --git a/cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java b/cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java index aa401b8e..c221150b 100644 --- a/cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java +++ b/cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java @@ -33,7 +33,7 @@ class ScrollGestureLayout extends GestureLayout { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { boolean horizontal; - Log.e("ScrollGestureLayout", "onScroll, distanceX="+distanceX+", distanceY="+distanceY); + // Log.e("ScrollGestureLayout", "onScroll, distanceX="+distanceX+", distanceY="+distanceY); if (e1.getX() != mPoints[0].x || e1.getY() != mPoints[0].y) { // First step. We choose now if it's a vertical or horizontal scroll, and // stick to it for the whole gesture. @@ -46,7 +46,7 @@ class ScrollGestureLayout extends GestureLayout { } mPoints[1].set(e2.getX(), e2.getY()); mDistance = horizontal ? (distanceX / getWidth()) : (distanceY / getHeight()); - mDistance = -mDistance; // they are provided inverted. + mDistance = horizontal ? -mDistance : mDistance; // When vertical, up = positive mNotify = true; return true; } @@ -71,7 +71,7 @@ class ScrollGestureLayout extends GestureLayout { mDetector.onTouchEvent(event); // Keep notifying CameraView as long as the gesture goes. - if (mNotify) Log.e("ScrollGestureLayout", "notifying a gesture "+mType.name()); + // if (mNotify) Log.e("ScrollGestureLayout", "notifying a gesture "+mType.name()); return mNotify; } @@ -91,7 +91,7 @@ class ScrollGestureLayout extends GestureLayout { float newValue = currValue + delta; if (newValue < minValue) newValue = minValue; if (newValue > maxValue) newValue = maxValue; - Log.e("ScrollGestureLayout", "curr="+currValue+", min="+minValue+", max="+maxValue+", out="+newValue); + // Log.e("ScrollGestureLayout", "curr="+currValue+", min="+minValue+", max="+maxValue+", out="+newValue); return newValue; }