From db1c60a948623e27a4b9ce6b61874f2187b3fc69 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Sun, 15 Dec 2019 19:47:26 +0100 Subject: [PATCH] Promote filters to stable - no experimental flag --- .../com/otaliastudios/cameraview/CameraView.java | 12 +----------- cameraview/src/main/res/values/attrs.xml | 3 +++ docs/_posts/2019-08-06-filters.md | 6 ++---- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index f7147f5a..37b3a521 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -667,7 +667,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { break; case FILTER_CONTROL_1: - if (!mExperimental) break; if (getFilter() instanceof OneParameterFilter) { OneParameterFilter filter = (OneParameterFilter) getFilter(); oldValue = filter.getParameter1(); @@ -679,7 +678,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { break; case FILTER_CONTROL_2: - if (!mExperimental) break; if (getFilter() instanceof TwoParameterFilter) { TwoParameterFilter filter = (TwoParameterFilter) getFilter(); oldValue = filter.getParameter2(); @@ -2333,11 +2331,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver { } else { boolean isNoFilter = filter instanceof NoFilter; boolean isFilterPreview = mCameraPreview instanceof FilterCameraPreview; - // If not experimental, we only allow NoFilter (called on creation). - if (!isNoFilter && !mExperimental) { - throw new RuntimeException("Filters are an experimental features and" + - " need the experimental flag set."); - } // If not a filter preview, we only allow NoFilter (called on creation). if (!isNoFilter && !isFilterPreview) { throw new RuntimeException("Filters are only supported by the GL_SURFACE preview." + @@ -2362,10 +2355,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver { */ @NonNull public Filter getFilter() { - if (!mExperimental) { - throw new RuntimeException("Filters are an experimental features and need " + - "the experimental flag set."); - } else if (mCameraPreview == null) { + if (mCameraPreview == null) { return mPendingFilter; } else if (mCameraPreview instanceof FilterCameraPreview) { return ((FilterCameraPreview) mCameraPreview).getCurrentFilter(); diff --git a/cameraview/src/main/res/values/attrs.xml b/cameraview/src/main/res/values/attrs.xml index 4411199e..371db28e 100644 --- a/cameraview/src/main/res/values/attrs.xml +++ b/cameraview/src/main/res/values/attrs.xml @@ -25,6 +25,9 @@ + + diff --git a/docs/_posts/2019-08-06-filters.md b/docs/_posts/2019-08-06-filters.md index 46a07274..d87159f4 100644 --- a/docs/_posts/2019-08-06-filters.md +++ b/docs/_posts/2019-08-06-filters.md @@ -13,10 +13,8 @@ Starting from version `2.1.0`, CameraView experimentally supports real-time filt the camera frames before they are shown and recorded. Just like [overlays](watermarks-and-overlays.html), these filters are applied to the preview and to any [picture or video snapshots](capturing-media.html). -Conditions: - -- you must set the experimental flag: `app:cameraExperimental="true"` -- you must use `Preview.GL_SURFACE` as a preview +Starting from `2.5.0`, this feature is considered to be stable and you do not need the experimental +flag to use it. The only condition is to use the `Preview.GL_SURFACE` preview. ### Simple usage