Update docs

pull/484/head
Mattia Iavarone 6 years ago
parent 1ff2525608
commit f45cdaea19
  1. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java
  2. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  3. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/gesture/Gesture.java
  4. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/gesture/GestureAction.java
  5. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/markers/AutoFocusTrigger.java
  6. 2
      demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java
  7. 12
      docs/_posts/2018-12-20-gestures.md
  8. 18
      docs/_posts/2018-12-20-more-features.md

@ -150,7 +150,7 @@ public class CameraOptions {
*/ */
public boolean supports(@NonNull GestureAction action) { public boolean supports(@NonNull GestureAction action) {
switch (action) { switch (action) {
case AUTOFOCUS: case AUTO_FOCUS:
return isAutoFocusSupported(); return isAutoFocusSupported();
case TAKE_PICTURE: case TAKE_PICTURE:
case NONE: case NONE:

@ -543,7 +543,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
takePicture(); takePicture();
break; break;
case AUTOFOCUS: case AUTO_FOCUS:
mCameraEngine.startAutoFocus(gesture, points[0]); mCameraEngine.startAutoFocus(gesture, points[0]);
break; break;

@ -30,7 +30,7 @@ public enum Gesture {
* Single tap gesture, typically assigned to the focus control. * Single tap gesture, typically assigned to the focus control.
* This gesture can be mapped to one shot actions: * This gesture can be mapped to one shot actions:
* *
* - {@link GestureAction#AUTOFOCUS} * - {@link GestureAction#AUTO_FOCUS}
* - {@link GestureAction#TAKE_PICTURE} * - {@link GestureAction#TAKE_PICTURE}
* - {@link GestureAction#NONE} * - {@link GestureAction#NONE}
*/ */
@ -40,7 +40,7 @@ public enum Gesture {
* Long tap gesture. * Long tap gesture.
* This gesture can be mapped to one shot actions: * This gesture can be mapped to one shot actions:
* *
* - {@link GestureAction#AUTOFOCUS} * - {@link GestureAction#AUTO_FOCUS}
* - {@link GestureAction#TAKE_PICTURE} * - {@link GestureAction#TAKE_PICTURE}
* - {@link GestureAction#NONE} * - {@link GestureAction#NONE}
*/ */

@ -31,7 +31,7 @@ public enum GestureAction {
* *
* To control marker drawing, please see {@link CameraView#setAutoFocusMarker(AutoFocusMarker)} * 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. * When triggered, this action will fire a picture shoot.

@ -9,7 +9,7 @@ import com.otaliastudios.cameraview.gesture.GestureAction;
public enum AutoFocusTrigger { public enum AutoFocusTrigger {
/** /**
* Autofocus was triggered by {@link GestureAction#AUTOFOCUS}. * Autofocus was triggered by {@link GestureAction#AUTO_FOCUS}.
*/ */
GESTURE, GESTURE,

@ -101,7 +101,7 @@ public enum Control {
ArrayList<GestureAction> list2 = new ArrayList<>(); ArrayList<GestureAction> list2 = new ArrayList<>();
addIfSupported(options, list2, GestureAction.NONE); addIfSupported(options, list2, GestureAction.NONE);
addIfSupported(options, list2, GestureAction.TAKE_PICTURE); addIfSupported(options, list2, GestureAction.TAKE_PICTURE);
addIfSupported(options, list2, GestureAction.AUTOFOCUS); addIfSupported(options, list2, GestureAction.AUTO_FOCUS);
return list2; return list2;
case GRID_COLOR: case GRID_COLOR:
ArrayList<GridColor> list3 = new ArrayList<>(); ArrayList<GridColor> list3 = new ArrayList<>();

@ -15,8 +15,8 @@ This lets you emulate typical behaviors in a single line:
```java ```java
cameraView.mapGesture(Gesture.PINCH, GestureAction.ZOOM); // Pinch to zoom! cameraView.mapGesture(Gesture.PINCH, GestureAction.ZOOM); // Pinch to zoom!
cameraView.mapGesture(Gesture.TAP, GestureAction.FOCUS_WITH_MARKER); // Tap to focus! cameraView.mapGesture(Gesture.TAP, GestureAction.AUTO_FOCUS); // Tap to focus!
cameraView.mapGesture(Gesture.LONG_TAP, GestureAction.CAPTURE); // Long tap to shoot! cameraView.mapGesture(Gesture.LONG_TAP, GestureAction.TAKE_PICTURE); // Long tap to shoot!
``` ```
Simple as that. There are two things to be noted: 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| |Gesture|Description|Can be mapped to|
|-------------|-----------|----------------| |-------------|-----------|----------------|
|`PINCH`|Pinch gesture, typically assigned to the zoom control.|`zoom` `exposureCorrection` `none`| |`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`| |`TAP`|Single tap gesture, typically assigned to the focus control.|`autoFocus` `takePicture` `none`|
|`LONG_TAP`|Long tap gesture.|`focus` `focusWithMarker` `capture` `none`| |`LONG_TAP`|Long tap gesture.|`autoFocus` `takePicture` `none`|
|`SCROLL_HORIZONTAL`|Horizontal movement gesture.|`zoom` `exposureCorrection` `none`| |`SCROLL_HORIZONTAL`|Horizontal movement gesture.|`zoom` `exposureCorrection` `none`|
|`SCROLL_VERTICAL`|Vertical 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 ```xml
<com.otaliastudios.cameraview.CameraView <com.otaliastudios.cameraview.CameraView
app:cameraGesturePinch="zoom|exposureCorrection|none" app:cameraGesturePinch="zoom|exposureCorrection|none"
app:cameraGestureTap="focus|focusWithMarker|capture|none" app:cameraGestureTap="autoFocus|takePicture|none"
app:cameraGestureLongTap="focus|focusWithMarker|capture|none" app:cameraGestureLongTap="autoFocus|takePicture|none"
app:cameraGestureScrollHorizontal="zoom|exposureCorrection|none" app:cameraGestureScrollHorizontal="zoom|exposureCorrection|none"
app:cameraGestureScrollVertical="zoom|exposureCorrection|none"/> app:cameraGestureScrollVertical="zoom|exposureCorrection|none"/>
``` ```

@ -57,6 +57,24 @@ cameraView.setGridColor(Color.WHITE);
cameraView.setGridColor(Color.BLACK); 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 ##### cameraAutoFocusResetDelay
Lets you control how an auto-focus operation is reset after completed. Lets you control how an auto-focus operation is reset after completed.

Loading…
Cancel
Save