From b81dd66f4fa9fff83b681e64d4bff4292de04a5c Mon Sep 17 00:00:00 2001 From: Andrei Diaconu Date: Wed, 29 Mar 2017 11:41:52 +0300 Subject: [PATCH] Added TORCH flash mode (to be used with video) --- .../src/main/api16/com/flurgle/camerakit/ConstantMapper.java | 1 + camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java | 1 + camerakit/src/main/java/com/flurgle/camerakit/CameraView.java | 2 ++ camerakit/src/main/types/com/flurgle/camerakit/Flash.java | 3 ++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/camerakit/src/main/api16/com/flurgle/camerakit/ConstantMapper.java b/camerakit/src/main/api16/com/flurgle/camerakit/ConstantMapper.java index 4e73e7c8..6b92febf 100644 --- a/camerakit/src/main/api16/com/flurgle/camerakit/ConstantMapper.java +++ b/camerakit/src/main/api16/com/flurgle/camerakit/ConstantMapper.java @@ -28,6 +28,7 @@ public class ConstantMapper { FLASH_MODES.put(CameraKit.Constants.FLASH_OFF, Camera.Parameters.FLASH_MODE_OFF); FLASH_MODES.put(CameraKit.Constants.FLASH_ON, Camera.Parameters.FLASH_MODE_ON); FLASH_MODES.put(CameraKit.Constants.FLASH_AUTO, Camera.Parameters.FLASH_MODE_AUTO); + FLASH_MODES.put(CameraKit.Constants.FLASH_TORCH, Camera.Parameters.FLASH_MODE_TORCH); } protected Flash(int cameraKitConstant) { diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java index 578b12e1..9a41d2ca 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java @@ -21,6 +21,7 @@ public class CameraKit { public static final int FLASH_OFF = 0; public static final int FLASH_ON = 1; public static final int FLASH_AUTO = 2; + public static final int FLASH_TORCH = 3; public static final int FOCUS_OFF = 0; public static final int FOCUS_CONTINUOUS = 1; diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java index e71b8055..2175102e 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java @@ -30,6 +30,7 @@ import static com.flurgle.camerakit.CameraKit.Constants.FACING_FRONT; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_AUTO; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_OFF; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_ON; +import static com.flurgle.camerakit.CameraKit.Constants.FLASH_TORCH; import static com.flurgle.camerakit.CameraKit.Constants.METHOD_STANDARD; import static com.flurgle.camerakit.CameraKit.Constants.PERMISSIONS_LAZY; import static com.flurgle.camerakit.CameraKit.Constants.PERMISSIONS_PICTURE; @@ -303,6 +304,7 @@ public class CameraView extends FrameLayout { break; case FLASH_AUTO: + case FLASH_TORCH: setFlash(FLASH_OFF); break; } diff --git a/camerakit/src/main/types/com/flurgle/camerakit/Flash.java b/camerakit/src/main/types/com/flurgle/camerakit/Flash.java index 08055486..e42800b0 100644 --- a/camerakit/src/main/types/com/flurgle/camerakit/Flash.java +++ b/camerakit/src/main/types/com/flurgle/camerakit/Flash.java @@ -8,8 +8,9 @@ import java.lang.annotation.RetentionPolicy; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_AUTO; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_OFF; import static com.flurgle.camerakit.CameraKit.Constants.FLASH_ON; +import static com.flurgle.camerakit.CameraKit.Constants.FLASH_TORCH; @Retention(RetentionPolicy.SOURCE) -@IntDef({FLASH_OFF, FLASH_ON, FLASH_AUTO}) +@IntDef({FLASH_OFF, FLASH_ON, FLASH_AUTO, FLASH_TORCH}) public @interface Flash { } \ No newline at end of file