From b5cf4d01ca525a2279f9f0da39a2e323e9ca3de7 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Tue, 29 Aug 2017 12:50:44 +0200 Subject: [PATCH] Improve supports() shorthands --- .../cameraview/CameraOptions.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java index 3b52da82..352d912d 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java @@ -132,6 +132,30 @@ public class CameraOptions { } + /** + * Shorthand for other methods in this class, + * e.g. supports(GestureAction.ZOOM) == isZoomSupported(). + * + * @param action value to be checked + * @return whether it's supported + */ + public boolean supports(GestureAction action) { + switch (action) { + case FOCUS: + case FOCUS_WITH_MARKER: + return isAutoFocusSupported(); + case CAPTURE: + case NONE: + return true; + case ZOOM: + return isZoomSupported(); + case EXPOSURE_CORRECTION: + return isExposureCorrectionSupported(); + } + return false; + } + + /** * Set of supported facing values. *