From b7f2152fc56c83be9d7c383de0154511119bb130 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Thu, 10 Aug 2017 21:18:22 +0200 Subject: [PATCH] Javadocs for gestures --- .../otaliastudios/cameraview/CameraView.java | 1 - .../com/otaliastudios/cameraview/Gesture.java | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index 116d4fb1..e530b3ca 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -39,7 +39,6 @@ import static android.view.View.MeasureSpec.UNSPECIFIED; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; /** - * TODO: docs for gestures * TODO: README for gestures * TODO: deprecate setFocus, CONTINUOUS should be the default * diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/Gesture.java b/cameraview/src/main/java/com/otaliastudios/cameraview/Gesture.java index 848dae46..d4d91d39 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/Gesture.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/Gesture.java @@ -6,13 +6,51 @@ import java.util.List; import static com.otaliastudios.cameraview.CameraConstants.*; + +/** + * Gestures listen to finger gestures over the {@link CameraView} bounds and can be mapped + * to one or more camera controls using XML attributes or {@link CameraView#mapGesture(Gesture, int)}. + * + * Not every gesture can control a certain action. For example, pinch gestures can only control + * continuous values, such as zoom or AE correction. Single point gestures, on the other hand, + * can only control point actions such as focusing or capturing a picture. + */ public enum Gesture { + /** + * Pinch gesture, typically assigned to the zoom control. + * This gesture can be mapped to: + * + * - {@link CameraConstants#GESTURE_ACTION_ZOOM} + * - {@link CameraConstants#GESTURE_ACTION_AE_CORRECTION} + * - {@link CameraConstants#GESTURE_ACTION_NONE} + */ PINCH(GESTURE_ACTION_ZOOM, GESTURE_ACTION_AE_CORRECTION), + + /** + * Single tap gesture, typically assigned to the focus control. + * This gesture can be mapped to: + * + * - {@link CameraConstants#GESTURE_ACTION_FOCUS} + * - {@link CameraConstants#GESTURE_ACTION_FOCUS_WITH_MARKER} + * - {@link CameraConstants#GESTURE_ACTION_CAPTURE} + * - {@link CameraConstants#GESTURE_ACTION_NONE} + */ TAP(GESTURE_ACTION_FOCUS, GESTURE_ACTION_FOCUS_WITH_MARKER, GESTURE_ACTION_CAPTURE), // DOUBLE_TAP(GESTURE_ACTION_FOCUS, GESTURE_ACTION_FOCUS_WITH_MARKER, GESTURE_ACTION_CAPTURE), + + /** + * Long tap gesture. + * This gesture can be mapped to: + * + * - {@link CameraConstants#GESTURE_ACTION_FOCUS} + * - {@link CameraConstants#GESTURE_ACTION_FOCUS_WITH_MARKER} + * - {@link CameraConstants#GESTURE_ACTION_CAPTURE} + * - {@link CameraConstants#GESTURE_ACTION_NONE} + */ LONG_TAP(GESTURE_ACTION_FOCUS, GESTURE_ACTION_FOCUS_WITH_MARKER, GESTURE_ACTION_CAPTURE); + Gesture(@GestureAction Integer... controls) { mControls = Arrays.asList(controls); }