diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConstants.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConstants.java
index 391f0cfb..87cd9b86 100644
--- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConstants.java
+++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConstants.java
@@ -6,14 +6,9 @@ public class CameraConstants {
public static final int PERMISSION_REQUEST_CODE = 16;
@Deprecated public static final int GESTURE_ACTION_NONE = 0;
- @Deprecated public static final int GESTURE_ACTION_FOCUS = 1;
- @Deprecated public static final int GESTURE_ACTION_FOCUS_WITH_MARKER = 2;
- @Deprecated public static final int GESTURE_ACTION_CAPTURE = 3;
- @Deprecated public static final int GESTURE_ACTION_ZOOM = 4;
- @Deprecated public static final int GESTURE_ACTION_AE_CORRECTION = 5;
-
@Deprecated public static final int FACING_BACK = 0;
- @Deprecated public static final int FACING_FRONT = 1;
+ @Deprecated public static final int FOCUS_CONTINUOUS = 1;
+ @Deprecated public static final int ZOOM_OFF = 0;
public static final int FLASH_OFF = 0;
public static final int FLASH_ON = 1;
@@ -42,24 +37,20 @@ public class CameraConstants {
public static final int WHITE_BALANCE_DAYLIGHT = 3;
public static final int WHITE_BALANCE_CLOUDY = 4;
- @Deprecated public static final int FOCUS_FIXED = 0;
- @Deprecated public static final int FOCUS_CONTINUOUS = 1;
- @Deprecated public static final int FOCUS_TAP = 2;
- @Deprecated public static final int FOCUS_TAP_WITH_MARKER = 3;
- @Deprecated public static final int ZOOM_OFF = 0;
- @Deprecated public static final int ZOOM_PINCH = 1;
- @Deprecated public static final int CAPTURE_METHOD_STANDARD = 0;
- @Deprecated public static final int CAPTURE_METHOD_FRAME = 1;
- @Deprecated public static final int PERMISSIONS_VIDEO = 0;
- @Deprecated public static final int PERMISSIONS_PICTURE = 1;
static class Defaults {
+
+ // TODO: Move to enum classes
static final int DEFAULT_GESTURE_ACTION_TAP = GESTURE_ACTION_NONE;
- // WIP static final int DEFAULT_GESTURE_ACTION_DOUBLE_TAP = GESTURE_ACTION_NONE;
static final int DEFAULT_GESTURE_ACTION_LONG_TAP = GESTURE_ACTION_NONE;
static final int DEFAULT_GESTURE_ACTION_PINCH = GESTURE_ACTION_NONE;
-
static final int DEFAULT_FACING = FACING_BACK;
+
+ // Deprecated
+ @Deprecated static final int DEFAULT_FOCUS = FOCUS_CONTINUOUS;
+ @Deprecated static final int DEFAULT_ZOOM = ZOOM_OFF;
+
+ // OK
static final int DEFAULT_FLASH = FLASH_OFF;
static final int DEFAULT_VIDEO_QUALITY = VIDEO_QUALITY_480P;
static final int DEFAULT_WHITE_BALANCE = WHITE_BALANCE_AUTO;
@@ -68,10 +59,6 @@ public class CameraConstants {
static final int DEFAULT_GRID = GRID_OFF;
static final boolean DEFAULT_CROP_OUTPUT = false;
- @Deprecated static final int DEFAULT_FOCUS = FOCUS_CONTINUOUS;
- @Deprecated static final int DEFAULT_ZOOM = ZOOM_OFF;
- @Deprecated static final int DEFAULT_METHOD = CAPTURE_METHOD_STANDARD;
- @Deprecated static final int DEFAULT_PERMISSIONS = PERMISSIONS_PICTURE;
}
}
diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
index 6214f0ef..3336adb0 100644
--- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
+++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
@@ -13,7 +13,6 @@ abstract class CameraController implements Preview.SurfaceCallback {
protected Facing mFacing;
@Flash protected int mFlash;
- @Focus protected int mFocus;
@VideoQuality protected int mVideoQuality;
@WhiteBalance protected int mWhiteBalance;
@SessionType protected int mSessionType;
@@ -63,11 +62,6 @@ abstract class CameraController implements Preview.SurfaceCallback {
return mFlash;
}
- @Focus
- final int getFocus() {
- return mFocus;
- }
-
@WhiteBalance
final int getWhiteBalance() {
return mWhiteBalance;
diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
index 034413db..a52b8546 100644
--- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
+++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
@@ -1314,7 +1314,7 @@ public class CameraView extends FrameLayout {
* @param focus no-op
*/
@Deprecated
- public void setFocus(@Focus int focus) {
+ public void setFocus(int focus) {
}
@@ -1324,9 +1324,8 @@ public class CameraView extends FrameLayout {
* @deprecated
*/
@Deprecated
- @Focus
public int getFocus() {
- return FOCUS_FIXED;
+ return Defaults.DEFAULT_FOCUS;
}
@@ -1336,7 +1335,7 @@ public class CameraView extends FrameLayout {
* @param method no-op
*/
@Deprecated
- public void setCaptureMethod(@Method int method) {}
+ public void setCaptureMethod(int method) {}
/**
@@ -1345,20 +1344,17 @@ public class CameraView extends FrameLayout {
* @param permissions no-op
*/
@Deprecated
- public void setPermissionPolicy(@Permissions int permissions) {}
+ public void setPermissionPolicy(int permissions) {}
/**
* Sets the zoom mode for the current session.
*
- * @see CameraConstants#ZOOM_OFF
- * @see CameraConstants#ZOOM_PINCH
- *
* @param zoom no-op
* @deprecated use {@link #mapGesture(Gesture, GestureAction)} to map zoom control to gestures
*/
@Deprecated
- public void setZoomMode(@ZoomMode int zoom) {
+ public void setZoomMode(int zoom) {
}
@@ -1367,10 +1363,9 @@ public class CameraView extends FrameLayout {
* @return no-op
* @deprecated use {@link #mapGesture(Gesture, GestureAction)} to map zoom control to gestures
*/
- @ZoomMode
@Deprecated
public int getZoomMode() {
- return ZOOM_OFF;
+ return Defaults.DEFAULT_ZOOM;
}
}
diff --git a/cameraview/src/main/options/com/otaliastudios/cameraview/Focus.java b/cameraview/src/main/options/com/otaliastudios/cameraview/Focus.java
deleted file mode 100644
index f1f09a83..00000000
--- a/cameraview/src/main/options/com/otaliastudios/cameraview/Focus.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.support.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static com.otaliastudios.cameraview.CameraConstants.FOCUS_TAP;
-import static com.otaliastudios.cameraview.CameraConstants.FOCUS_FIXED;
-import static com.otaliastudios.cameraview.CameraConstants.FOCUS_CONTINUOUS;
-import static com.otaliastudios.cameraview.CameraConstants.FOCUS_TAP_WITH_MARKER;
-
-@Retention(RetentionPolicy.SOURCE)
-@IntDef({FOCUS_CONTINUOUS, FOCUS_TAP, FOCUS_FIXED, FOCUS_TAP_WITH_MARKER})
-@Deprecated
-public @interface Focus {
-}
\ No newline at end of file
diff --git a/cameraview/src/main/options/com/otaliastudios/cameraview/Method.java b/cameraview/src/main/options/com/otaliastudios/cameraview/Method.java
deleted file mode 100644
index 1822a7be..00000000
--- a/cameraview/src/main/options/com/otaliastudios/cameraview/Method.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.support.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static com.otaliastudios.cameraview.CameraConstants.CAPTURE_METHOD_STANDARD;
-import static com.otaliastudios.cameraview.CameraConstants.CAPTURE_METHOD_FRAME;
-
-@Deprecated
-@Retention(RetentionPolicy.SOURCE)
-@IntDef({CAPTURE_METHOD_STANDARD, CAPTURE_METHOD_FRAME})
-public @interface Method {
-}
diff --git a/cameraview/src/main/options/com/otaliastudios/cameraview/Permissions.java b/cameraview/src/main/options/com/otaliastudios/cameraview/Permissions.java
deleted file mode 100644
index 6fb8cb7d..00000000
--- a/cameraview/src/main/options/com/otaliastudios/cameraview/Permissions.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.support.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static com.otaliastudios.cameraview.CameraConstants.PERMISSIONS_PICTURE;
-import static com.otaliastudios.cameraview.CameraConstants.PERMISSIONS_VIDEO;
-
-@Deprecated
-@Retention(RetentionPolicy.SOURCE)
-@IntDef({PERMISSIONS_VIDEO, PERMISSIONS_PICTURE})
-public @interface Permissions {
-}
diff --git a/cameraview/src/main/options/com/otaliastudios/cameraview/ZoomMode.java b/cameraview/src/main/options/com/otaliastudios/cameraview/ZoomMode.java
deleted file mode 100644
index e657f77a..00000000
--- a/cameraview/src/main/options/com/otaliastudios/cameraview/ZoomMode.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.support.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static com.otaliastudios.cameraview.CameraConstants.ZOOM_OFF;
-import static com.otaliastudios.cameraview.CameraConstants.ZOOM_PINCH;
-
-@Retention(RetentionPolicy.SOURCE)
-@IntDef({ZOOM_OFF, ZOOM_PINCH})
-@Deprecated
-public @interface ZoomMode {
-}
diff --git a/cameraview/src/main/views/com/otaliastudios/cameraview/FocusMarkerLayout.java b/cameraview/src/main/views/com/otaliastudios/cameraview/FocusMarkerLayout.java
deleted file mode 100644
index 56a162cf..00000000
--- a/cameraview/src/main/views/com/otaliastudios/cameraview/FocusMarkerLayout.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-
-@Deprecated
-class FocusMarkerLayout extends FrameLayout {
-
- private FrameLayout mFocusMarkerContainer;
- private ImageView mFill;
- private boolean mEnabled;
-
- public FocusMarkerLayout(@NonNull Context context) {
- this(context, null);
- }
-
- public FocusMarkerLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
- LayoutInflater.from(getContext()).inflate(R.layout.layout_focus_marker, this);
-
- mFocusMarkerContainer = (FrameLayout) findViewById(R.id.focusMarkerContainer);
- mFill = (ImageView) findViewById(R.id.fill);
- mFocusMarkerContainer.setAlpha(0);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- int action = event.getAction();
- if (action == MotionEvent.ACTION_UP && mEnabled) {
- focus(event.getX(), event.getY());
- return true;
- }
- return false; // We didn't consume, pass
- }
-
- public void focus(float mx, float my) {
- int x = (int) (mx - mFocusMarkerContainer.getWidth() / 2);
- int y = (int) (my - mFocusMarkerContainer.getWidth() / 2);
-
- mFocusMarkerContainer.setTranslationX(x);
- mFocusMarkerContainer.setTranslationY(y);
-
- mFocusMarkerContainer.animate().setListener(null).cancel();
- mFill.animate().setListener(null).cancel();
-
- mFill.setScaleX(0);
- mFill.setScaleY(0);
- mFill.setAlpha(1f);
-
- mFocusMarkerContainer.setScaleX(1.36f);
- mFocusMarkerContainer.setScaleY(1.36f);
- mFocusMarkerContainer.setAlpha(1f);
-
- mFocusMarkerContainer.animate().scaleX(1).scaleY(1).setStartDelay(0).setDuration(330)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- mFocusMarkerContainer.animate().alpha(0).setStartDelay(750).setDuration(800).setListener(null).start();
- }
- }).start();
-
- mFill.animate().scaleX(1).scaleY(1).setDuration(330)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- mFill.animate().alpha(0).setDuration(800).setListener(null).start();
- }
- }).start();
- }
-
-
- public void enable(boolean enable) {
- mEnabled = enable;
- }
-}
diff --git a/cameraview/src/main/views/com/otaliastudios/cameraview/PinchToZoomLayout.java b/cameraview/src/main/views/com/otaliastudios/cameraview/PinchToZoomLayout.java
deleted file mode 100644
index 45b4412e..00000000
--- a/cameraview/src/main/views/com/otaliastudios/cameraview/PinchToZoomLayout.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.otaliastudios.cameraview;
-
-import android.content.Context;
-import android.graphics.PointF;
-import android.os.Build;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.ScaleGestureDetector;
-import android.view.View;
-
-@Deprecated
-class PinchToZoomLayout extends View {
-
-
- private ScaleGestureDetector mDetector;
- private boolean mNotify;
- private boolean mEnabled;
- @ZoomMode private int mZoomMode;
- private float mZoom = 0;
- private PointF[] mPoints = new PointF[]{
- new PointF(0, 0),
- new PointF(0, 0)
- };
-
- public PinchToZoomLayout(@NonNull Context context) {
- this(context, null);
- }
-
- public PinchToZoomLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
- super(context, attrs);
- mDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() {
- @Override
- public boolean onScale(ScaleGestureDetector detector) {
- mNotify = true;
- mZoom += ((detector.getScaleFactor() - 1) * 2);
- if (mZoom < 0) mZoom = 0;
- if (mZoom > 1) mZoom = 1;
- return true;
- }
- });
-
- if (Build.VERSION.SDK_INT >= 19) {
- mDetector.setQuickScaleEnabled(false);
- }
- }
-
- @ZoomMode
- public int getZoomMode() {
- return mZoomMode;
- }
-
- public void setZoomMode(@ZoomMode int zoomMode) {
- mZoomMode = zoomMode;
- }
-
- public float getZoom() {
- return mZoom;
- }
-
- public void onExternalZoom(float zoom) {
- mZoom = zoom;
- }
-
- public PointF[] getPoints() {
- return mPoints;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (mZoomMode != CameraConstants.ZOOM_PINCH) return false;
- if (!mEnabled) return false;
-
- // Reset the mNotify flag on a new gesture.
- // This is to ensure that the mNotify flag stays on until the
- // previous gesture ends.
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- mNotify = false;
- }
-
- // Let's see if we detect something. This will call onScale().
- mDetector.onTouchEvent(event);
-
- // Keep notifying CameraView as long as the gesture goes.
- if (mNotify) {
- mPoints[0].x = event.getX(0);
- mPoints[0].y = event.getY(0);
- if (event.getPointerCount() > 1) {
- mPoints[1].x = event.getX(1);
- mPoints[1].y = event.getY(1);
- }
- return true;
- }
- return false;
- }
-
- public void enable(boolean enable) {
- mEnabled = enable;
- }
-}
diff --git a/demo/src/main/java/com/otaliastudios/cameraview/demo/MainActivity.java b/demo/src/main/java/com/otaliastudios/cameraview/demo/MainActivity.java
index 52f54a12..a059e145 100644
--- a/demo/src/main/java/com/otaliastudios/cameraview/demo/MainActivity.java
+++ b/demo/src/main/java/com/otaliastudios/cameraview/demo/MainActivity.java
@@ -41,10 +41,6 @@ public class MainActivity extends AppCompatActivity implements View.OnLayoutChan
@BindView(R.id.cropModeRadioGroup)
RadioGroup cropModeRadioGroup;
- // Pinch to zoom:
- @BindView(R.id.zoomModeRadioGroup)
- RadioGroup zoomModeRadioGroup;
-
// Video Quality:
@BindView(R.id.videoQualityRadioGroup)
RadioGroup videoQualityRadioGroup;
@@ -100,7 +96,6 @@ public class MainActivity extends AppCompatActivity implements View.OnLayoutChan
heightModeRadioGroup.setOnCheckedChangeListener(heightModeChangedListener);
videoQualityRadioGroup.setOnCheckedChangeListener(videoQualityChangedListener);
gridModeRadioGroup.setOnCheckedChangeListener(gridModeChangedListener);
- zoomModeRadioGroup.setOnCheckedChangeListener(zoomModeChangedListener);
camera.addOnLayoutChangeListener(this);
camera.addCameraListener(new CameraListener() {
@@ -274,19 +269,6 @@ public class MainActivity extends AppCompatActivity implements View.OnLayoutChan
};
- RadioGroup.OnCheckedChangeListener zoomModeChangedListener = new RadioGroup.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- int zoom = CameraConstants.ZOOM_OFF;
- switch (checkedId) {
- case R.id.zoomModeOff: zoom = CameraConstants.ZOOM_OFF; break;
- case R.id.zoomModePinch: zoom = CameraConstants.ZOOM_PINCH; break;
- }
- camera.setZoomMode(zoom);
- message("Zoom mode changed! Note that pinch-to-zoom won't work well in ScrollViews like here", true);
- }
- };
-
@OnClick(R.id.widthUpdate)
void widthUpdateClicked() {
if (mCapturingPicture) return;
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index b0bb2fee..37718f99 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -197,59 +197,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-