From 2429cc114bc48184f6c5c5d12f544d7c3517feb0 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Fri, 4 Dec 2020 15:49:39 +0100 Subject: [PATCH] Add CameraEngine.getRepeatingRequestDefaultTemplate (#1004) * Fix Codecov * Add getRepeatingRequestDefaultTemplate --- .github/workflows/build.yml | 2 -- .github/workflows/deploy.yml | 1 - .../cameraview/engine/Camera2Engine.java | 15 ++++++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a3bd6d2..37fb81c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,8 +6,6 @@ on: branches: - master pull_request: -env: - TRAVIS: true jobs: ANDROID_BASE_CHECKS: name: Base Checks diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8390af24..7eed30cd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,7 +8,6 @@ jobs: name: Bintray Upload runs-on: ubuntu-latest env: - TRAVIS: true BINTRAY_USER: ${{ secrets.BINTRAY_USER }} BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }} diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java index 505d690f..b945d4a0 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java @@ -228,6 +228,15 @@ public class Camera2Engine extends CameraBaseEngine implements } } + /** + * Can be changed to select something different than {@link CameraDevice#TEMPLATE_PREVIEW} + * for the default repeating request. + * @return the default template for preview + */ + protected int getRepeatingRequestDefaultTemplate() { + return CameraDevice.TEMPLATE_PREVIEW; + } + /** * Applies the repeating request builder to the preview, assuming we actually have a preview * running. Can be called after changing parameters to the builder. @@ -419,7 +428,7 @@ public class Camera2Engine extends CameraBaseEngine implements + mPictureFormat); } mCameraOptions = new Camera2Options(mManager, mCameraId, flip, format); - createRepeatingRequestBuilder(CameraDevice.TEMPLATE_PREVIEW); + createRepeatingRequestBuilder(getRepeatingRequestDefaultTemplate()); } catch (CameraAccessException e) { task.trySetException(createCameraException(e)); return; @@ -977,9 +986,9 @@ public class Camera2Engine extends CameraBaseEngine implements @EngineThread private void maybeRestorePreviewTemplateAfterVideo() { int template = (int) mRepeatingRequestBuilder.build().getTag(); - if (template != CameraDevice.TEMPLATE_PREVIEW) { + if (template != getRepeatingRequestDefaultTemplate()) { try { - createRepeatingRequestBuilder(CameraDevice.TEMPLATE_PREVIEW); + createRepeatingRequestBuilder(getRepeatingRequestDefaultTemplate()); addRepeatingRequestBuilderSurfaces(); applyRepeatingRequestBuilder(); } catch (CameraAccessException e) {