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); }