diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java index c5527295..2fcd1000 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java @@ -150,7 +150,7 @@ public class CameraOptions { */ public boolean supports(@NonNull GestureAction action) { switch (action) { - case AUTOFOCUS: + case AUTO_FOCUS: return isAutoFocusSupported(); case TAKE_PICTURE: case NONE: diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index e68a0b74..e5896c50 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -543,7 +543,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver { takePicture(); break; - case AUTOFOCUS: + case AUTO_FOCUS: mCameraEngine.startAutoFocus(gesture, points[0]); break; diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/Gesture.java b/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/Gesture.java index 92f33c05..0599f60f 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/Gesture.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/Gesture.java @@ -30,7 +30,7 @@ public enum Gesture { * Single tap gesture, typically assigned to the focus control. * This gesture can be mapped to one shot actions: * - * - {@link GestureAction#AUTOFOCUS} + * - {@link GestureAction#AUTO_FOCUS} * - {@link GestureAction#TAKE_PICTURE} * - {@link GestureAction#NONE} */ @@ -40,7 +40,7 @@ public enum Gesture { * Long tap gesture. * This gesture can be mapped to one shot actions: * - * - {@link GestureAction#AUTOFOCUS} + * - {@link GestureAction#AUTO_FOCUS} * - {@link GestureAction#TAKE_PICTURE} * - {@link GestureAction#NONE} */ 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 32146389..61294b96 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java @@ -31,7 +31,7 @@ public enum GestureAction { * * To control marker drawing, please see {@link CameraView#setAutoFocusMarker(AutoFocusMarker)} */ - AUTOFOCUS(1, GestureType.ONE_SHOT), + AUTO_FOCUS(1, GestureType.ONE_SHOT), /** * When triggered, this action will fire a picture shoot. diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/markers/AutoFocusTrigger.java b/cameraview/src/main/java/com/otaliastudios/cameraview/markers/AutoFocusTrigger.java index b4a5fc93..8303aa79 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/markers/AutoFocusTrigger.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/markers/AutoFocusTrigger.java @@ -9,7 +9,7 @@ import com.otaliastudios.cameraview.gesture.GestureAction; public enum AutoFocusTrigger { /** - * Autofocus was triggered by {@link GestureAction#AUTOFOCUS}. + * Autofocus was triggered by {@link GestureAction#AUTO_FOCUS}. */ GESTURE, diff --git a/demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java b/demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java index 9a1392c0..6910362c 100644 --- a/demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java +++ b/demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java @@ -101,7 +101,7 @@ public enum Control { ArrayList list2 = new ArrayList<>(); addIfSupported(options, list2, GestureAction.NONE); addIfSupported(options, list2, GestureAction.TAKE_PICTURE); - addIfSupported(options, list2, GestureAction.AUTOFOCUS); + addIfSupported(options, list2, GestureAction.AUTO_FOCUS); return list2; case GRID_COLOR: ArrayList list3 = new ArrayList<>(); diff --git a/docs/_posts/2018-12-20-gestures.md b/docs/_posts/2018-12-20-gestures.md index 4710f299..2f446903 100644 --- a/docs/_posts/2018-12-20-gestures.md +++ b/docs/_posts/2018-12-20-gestures.md @@ -15,8 +15,8 @@ This lets you emulate typical behaviors in a single line: ```java cameraView.mapGesture(Gesture.PINCH, GestureAction.ZOOM); // Pinch to zoom! -cameraView.mapGesture(Gesture.TAP, GestureAction.FOCUS_WITH_MARKER); // Tap to focus! -cameraView.mapGesture(Gesture.LONG_TAP, GestureAction.CAPTURE); // Long tap to shoot! +cameraView.mapGesture(Gesture.TAP, GestureAction.AUTO_FOCUS); // Tap to focus! +cameraView.mapGesture(Gesture.LONG_TAP, GestureAction.TAKE_PICTURE); // Long tap to shoot! ``` Simple as that. There are two things to be noted: @@ -27,8 +27,8 @@ Simple as that. There are two things to be noted: |Gesture|Description|Can be mapped to| |-------------|-----------|----------------| |`PINCH`|Pinch gesture, typically assigned to the zoom control.|`zoom` `exposureCorrection` `none`| -|`TAP`|Single tap gesture, typically assigned to the focus control.|`focus` `focusWithMarker` `capture` `none`| -|`LONG_TAP`|Long tap gesture.|`focus` `focusWithMarker` `capture` `none`| +|`TAP`|Single tap gesture, typically assigned to the focus control.|`autoFocus` `takePicture` `none`| +|`LONG_TAP`|Long tap gesture.|`autoFocus` `takePicture` `none`| |`SCROLL_HORIZONTAL`|Horizontal movement gesture.|`zoom` `exposureCorrection` `none`| |`SCROLL_VERTICAL`|Vertical movement gesture.|`zoom` `exposureCorrection` `none`| @@ -37,8 +37,8 @@ Simple as that. There are two things to be noted: ```xml ``` diff --git a/docs/_posts/2018-12-20-more-features.md b/docs/_posts/2018-12-20-more-features.md index 0cbc969e..084676c9 100644 --- a/docs/_posts/2018-12-20-more-features.md +++ b/docs/_posts/2018-12-20-more-features.md @@ -57,6 +57,24 @@ cameraView.setGridColor(Color.WHITE); cameraView.setGridColor(Color.BLACK); ``` +##### cameraAutoFocusMarker + +Lets you set a marker for drawing on screen in response to auto focus events. +In XML, you should pass the qualified class name of your marker. + +```java +cameraView.setAutoFocusMarker(null); +cameraView.setAutoFocusMarker(marker); +``` + +We offer a default marker (similar to the old `focusWithMarker` attribute in v1), +which you can set in XML using the `@string/cameraview_default_autofocus_marker` resource, +or programmatically: + +```java +cameraView.setAutoFocusMarker(new DefaultAutoFocusMarker()); +``` + ##### cameraAutoFocusResetDelay Lets you control how an auto-focus operation is reset after completed.