Add CameraEngine.getRepeatingRequestDefaultTemplate (#1004)

* Fix Codecov

* Add getRepeatingRequestDefaultTemplate
pull/1020/head
Mattia Iavarone 4 years ago committed by GitHub
parent 0001ab7a54
commit 2429cc114b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/build.yml
  2. 1
      .github/workflows/deploy.yml
  3. 15
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java

@ -6,8 +6,6 @@ on:
branches:
- master
pull_request:
env:
TRAVIS: true
jobs:
ANDROID_BASE_CHECKS:
name: Base Checks

@ -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 }}

@ -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) {

Loading…
Cancel
Save