From b5c82cf253616e1d86431f36bee6a50a330d53b4 Mon Sep 17 00:00:00 2001 From: EzequielAdrianM Date: Tue, 12 Jan 2021 16:01:20 -0300 Subject: [PATCH] Add Gesture Action TakePictureSnapshot Added a new GestureAction.TAKE_PICTURE_SNAPSHOT that calls takePictureSnapshot() method. --- .../otaliastudios/cameraview/CameraView.java | 4 ++++ .../cameraview/gesture/GestureAction.java | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index e3ce402c..28894132 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -687,6 +687,10 @@ public class CameraView extends FrameLayout implements LifecycleObserver { //noinspection ConstantConditions switch (action) { + case TAKE_PICTURE_SNAPSHOT: + takePictureSnapshot(); + break; + case TAKE_PICTURE: takePicture(); break; diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java b/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java index ca86a6c3..63c5152a 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java @@ -43,6 +43,15 @@ public enum GestureAction { */ TAKE_PICTURE(2, GestureType.ONE_SHOT), + /** + * When triggered, this action will fire a picture snapshot. + * This action can be mapped to one shot gestures: + * + * - {@link Gesture#TAP} + * - {@link Gesture#LONG_TAP} + */ + TAKE_PICTURE_SNAPSHOT(3, GestureType.ONE_SHOT), + /** * Zoom control, typically assigned to the pinch gesture. * This action can be mapped to continuous gestures: @@ -51,7 +60,7 @@ public enum GestureAction { * - {@link Gesture#SCROLL_HORIZONTAL} * - {@link Gesture#SCROLL_VERTICAL} */ - ZOOM(3, GestureType.CONTINUOUS), + ZOOM(4, GestureType.CONTINUOUS), /** * Exposure correction control. @@ -61,7 +70,7 @@ public enum GestureAction { * - {@link Gesture#SCROLL_HORIZONTAL} * - {@link Gesture#SCROLL_VERTICAL} */ - EXPOSURE_CORRECTION(4, GestureType.CONTINUOUS), + EXPOSURE_CORRECTION(5, GestureType.CONTINUOUS), /** * Controls the first parameter of a real-time {@link Filter}, @@ -71,7 +80,7 @@ public enum GestureAction { * - {@link Gesture#SCROLL_HORIZONTAL} * - {@link Gesture#SCROLL_VERTICAL} */ - FILTER_CONTROL_1(5, GestureType.CONTINUOUS), + FILTER_CONTROL_1(6, GestureType.CONTINUOUS), /** * Controls the second parameter of a real-time {@link Filter}, @@ -81,7 +90,7 @@ public enum GestureAction { * - {@link Gesture#SCROLL_HORIZONTAL} * - {@link Gesture#SCROLL_VERTICAL} */ - FILTER_CONTROL_2(6, GestureType.CONTINUOUS); + FILTER_CONTROL_2(7, GestureType.CONTINUOUS); final static GestureAction DEFAULT_PINCH = NONE; final static GestureAction DEFAULT_TAP = NONE;