Merge branch 'main' into master

pull/1049/head
rolandwo 4 years ago committed by GitHub
commit 4de9cf408f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .github/workflows/build.yml
  2. 15
      .github/workflows/deploy.yml
  3. 23
      .github/workflows/snapshot.yml
  4. 2
      LICENSE
  5. 4
      README.md
  6. 8
      build.gradle.kts
  7. 47
      cameraview/build.gradle.kts
  8. 19
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraViewTest.java
  9. 32
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  10. 10
      cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java
  11. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/internal/FpsRangeValidator.java
  12. 14
      cameraview/src/main/java/com/otaliastudios/cameraview/overlay/Overlay.java
  13. 8
      cameraview/src/main/java/com/otaliastudios/cameraview/overlay/OverlayDrawer.java
  14. 15
      cameraview/src/main/java/com/otaliastudios/cameraview/overlay/OverlayLayout.java
  15. 2
      cameraview/src/main/res/values/attrs.xml
  16. 4
      demo/build.gradle.kts
  17. 14
      docs/_about/changelog.md
  18. 2
      docs/_about/faq.md
  19. 6
      docs/_about/install.md
  20. 4
      docs/_config.yml
  21. 16
      docs/_docs/watermarks-and-overlays.md
  22. 2
      docs/_extra/contributing.md
  23. 2
      gradle/wrapper/gradle-wrapper.properties

@ -4,7 +4,6 @@ name: Build
on: on:
push: push:
branches: branches:
- master
- main - main
pull_request: pull_request:
jobs: jobs:

@ -4,17 +4,18 @@ on:
release: release:
types: [published] types: [published]
jobs: jobs:
BINTRAY_UPLOAD: MAVEN_UPLOAD:
name: Bintray Upload name: Maven Upload
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
BINTRAY_REPO: ${{ secrets.BINTRAY_REPO }} SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: Perform bintray upload - name: Perform maven upload
run: ./gradlew cameraview:publishToBintray run: ./gradlew publishToSonatype

@ -0,0 +1,23 @@
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
# Renaming ? Change the README badge.
name: Snapshot
on:
push:
branches:
- main
jobs:
SNAPSHOT:
name: Publish Snapshot
runs-on: ubuntu-latest
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Publish sonatype snapshot
run: ./gradlew publishToSonatypeSnapshot

@ -1,7 +1,7 @@
Copyrights for portions of project CameraView are held by WonderKiln, Inc as Copyrights for portions of project CameraView are held by WonderKiln, Inc as
part of project CameraKit-Android (https://github.com/wonderkiln/CameraKit-Android). part of project CameraKit-Android (https://github.com/wonderkiln/CameraKit-Android).
Their original license is available below, or at Their original license is available below, or at
https://github.com/wonderkiln/CameraKit-Android/blob/master/LICENSE . https://github.com/wonderkiln/CameraKit-Android/blob/main/LICENSE .
All other copyrights for project CameraView are held by Otalia Studios, 2017. All other copyrights for project CameraView are held by Otalia Studios, 2017.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------

@ -1,5 +1,5 @@
[![Build Status](https://github.com/natario1/CameraView/workflows/Build/badge.svg?event=push)](https://github.com/natario1/CameraView/actions) [![Build Status](https://github.com/natario1/CameraView/workflows/Build/badge.svg?event=push)](https://github.com/natario1/CameraView/actions)
[![Code Coverage](https://codecov.io/gh/natario1/CameraView/branch/master/graph/badge.svg)](https://codecov.io/gh/natario1/CameraView) [![Code Coverage](https://codecov.io/gh/natario1/CameraView/branch/main/graph/badge.svg)](https://codecov.io/gh/natario1/CameraView)
[![Release](https://img.shields.io/github/release/natario1/CameraView.svg)](https://github.com/natario1/CameraView/releases) [![Release](https://img.shields.io/github/release/natario1/CameraView.svg)](https://github.com/natario1/CameraView/releases)
[![Issues](https://img.shields.io/github/issues-raw/natario1/CameraView.svg)](https://github.com/natario1/CameraView/issues) [![Issues](https://img.shields.io/github/issues-raw/natario1/CameraView.svg)](https://github.com/natario1/CameraView/issues)
[![Funding](https://img.shields.io/opencollective/all/CameraView.svg?colorB=r)](https://natario1.github.io/CameraView/extra/donate) [![Funding](https://img.shields.io/opencollective/all/CameraView.svg?colorB=r)](https://natario1.github.io/CameraView/extra/donate)
@ -22,7 +22,7 @@ CameraView is a well documented, high-level library that makes capturing picture
addressing most of the common issues and needs, and still leaving you with flexibility where needed. addressing most of the common issues and needs, and still leaving you with flexibility where needed.
```groovy ```groovy
api 'com.otaliastudios:cameraview:2.7.0' api 'com.otaliastudios:cameraview:2.7.1'
``` ```
- Fast & reliable - Fast & reliable

@ -8,13 +8,12 @@ buildscript {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter()
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:4.1.2") classpath("com.android.tools.build:gradle:4.2.2")
classpath("io.deepmedia.tools:publisher:0.4.1") classpath("io.deepmedia.tools:publisher:0.6.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20")
} }
} }
@ -23,7 +22,6 @@ allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter()
} }
} }

@ -1,5 +1,6 @@
import io.deepmedia.tools.publisher.common.License import io.deepmedia.tools.publisher.common.License
import io.deepmedia.tools.publisher.common.Release import io.deepmedia.tools.publisher.common.Release
import io.deepmedia.tools.publisher.common.GithubScm
plugins { plugins {
id("com.android.library") id("com.android.library")
@ -14,7 +15,7 @@ android {
setMinSdkVersion(property("minSdkVersion") as Int) setMinSdkVersion(property("minSdkVersion") as Int)
setTargetSdkVersion(property("targetSdkVersion") as Int) setTargetSdkVersion(property("targetSdkVersion") as Int)
versionCode = 1 versionCode = 1
versionName = "2.7.0" versionName = "2.7.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument("filter", "" + testInstrumentationRunnerArgument("filter", "" +
"com.otaliastudios.cameraview.tools.SdkExcludeFilter," + "com.otaliastudios.cameraview.tools.SdkExcludeFilter," +
@ -28,17 +29,17 @@ dependencies {
testImplementation("junit:junit:4.13") testImplementation("junit:junit:4.13")
testImplementation("org.mockito:mockito-inline:2.28.2") testImplementation("org.mockito:mockito-inline:2.28.2")
androidTestImplementation("androidx.test:runner:1.3.0") androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.test:rules:1.3.0") androidTestImplementation("androidx.test:rules:1.4.0")
androidTestImplementation("androidx.test.ext:junit:1.1.2") androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("org.mockito:mockito-android:2.28.2") androidTestImplementation("org.mockito:mockito-android:2.28.2")
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
api("androidx.exifinterface:exifinterface:1.3.2") api("androidx.exifinterface:exifinterface:1.3.2")
api("androidx.lifecycle:lifecycle-common:2.2.0") api("androidx.lifecycle:lifecycle-common:2.3.1")
api("com.google.android.gms:play-services-tasks:17.2.0") api("com.google.android.gms:play-services-tasks:17.2.1")
implementation("androidx.annotation:annotation:1.1.0") implementation("androidx.annotation:annotation:1.2.0")
implementation("com.otaliastudios.opengl:egloo:0.5.3") implementation("com.otaliastudios.opengl:egloo:0.6.1")
} }
// Publishing // Publishing
@ -50,16 +51,28 @@ publisher {
project.artifact = "cameraview" project.artifact = "cameraview"
project.group = "com.otaliastudios" project.group = "com.otaliastudios"
project.url = "https://github.com/natario1/CameraView" project.url = "https://github.com/natario1/CameraView"
project.scm = GithubScm("natario1", "CameraView")
project.addLicense(License.APACHE_2_0) project.addLicense(License.APACHE_2_0)
bintray { project.addDeveloper("natario1", "mat.iavarone@gmail.com")
release.sources = Release.SOURCES_AUTO release.sources = Release.SOURCES_AUTO
release.docs = Release.DOCS_AUTO release.docs = Release.DOCS_AUTO
auth.user = "BINTRAY_USER"
auth.key = "BINTRAY_KEY" directory()
auth.repo = "BINTRAY_REPO"
sonatype {
auth.user = "SONATYPE_USER"
auth.password = "SONATYPE_PASSWORD"
signing.key = "SIGNING_KEY"
signing.password = "SIGNING_PASSWORD"
} }
directory {
directory = file(repositories.mavenLocal().url).absolutePath sonatype("snapshot") {
repository = io.deepmedia.tools.publisher.sonatype.Sonatype.OSSRH_SNAPSHOT_1
release.version = "latest-SNAPSHOT"
auth.user = "SONATYPE_USER"
auth.password = "SONATYPE_PASSWORD"
signing.key = "SIGNING_KEY"
signing.password = "SIGNING_PASSWORD"
} }
} }

@ -216,6 +216,17 @@ public class CameraViewTest extends BaseTest {
assertEquals(cameraView.getGestureAction(Gesture.PINCH), GestureAction.NONE); assertEquals(cameraView.getGestureAction(Gesture.PINCH), GestureAction.NONE);
} }
@Test
public void testGesture_enabled() {
// Ensure touch events are intercepted when at least one gesture is set
cameraView.mapGesture(Gesture.PINCH, GestureAction.ZOOM);
assertTrue(cameraView.onInterceptTouchEvent(null));
// Ensure touch events are NOT intercepted when no gestures are set
cameraView.clearGesture(Gesture.PINCH);
assertFalse(cameraView.onInterceptTouchEvent(null));
}
@Test @Test
public void testGesture_enablingDisablingLayouts() { public void testGesture_enablingDisablingLayouts() {
cameraView.clearGesture(Gesture.TAP); cameraView.clearGesture(Gesture.TAP);
@ -902,6 +913,14 @@ public class CameraViewTest extends BaseTest {
cameraView.setFrameProcessingExecutors(0); cameraView.setFrameProcessingExecutors(0);
} }
@Test
public void testDrawHardwareOverlays() {
cameraView.setDrawHardwareOverlays(true);
assertTrue(cameraView.getDrawHardwareOverlays());
cameraView.setDrawHardwareOverlays(false);
assertFalse(cameraView.getDrawHardwareOverlays());
}
//endregion //endregion
//region Lists of listeners and processors //region Lists of listeners and processors

@ -133,6 +133,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
private Engine mEngine; private Engine mEngine;
private Filter mPendingFilter; private Filter mPendingFilter;
private int mFrameProcessingExecutors; private int mFrameProcessingExecutors;
private int mActiveGestures;
// Components // Components
private Handler mUiHandler; private Handler mUiHandler;
@ -226,6 +227,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
int frameExecutors = a.getInteger(R.styleable.CameraView_cameraFrameProcessingExecutors, int frameExecutors = a.getInteger(R.styleable.CameraView_cameraFrameProcessingExecutors,
DEFAULT_FRAME_PROCESSING_EXECUTORS); DEFAULT_FRAME_PROCESSING_EXECUTORS);
boolean drawHardwareOverlays = a.getBoolean(R.styleable.CameraView_cameraDrawHardwareOverlays, false);
// Size selectors and gestures // Size selectors and gestures
SizeSelectorParser sizeSelectors = new SizeSelectorParser(a); SizeSelectorParser sizeSelectors = new SizeSelectorParser(a);
GestureParser gestures = new GestureParser(a); GestureParser gestures = new GestureParser(a);
@ -259,6 +262,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
setUseDeviceOrientation(useDeviceOrientation); setUseDeviceOrientation(useDeviceOrientation);
setGrid(controls.getGrid()); setGrid(controls.getGrid());
setGridColor(gridColor); setGridColor(gridColor);
setDrawHardwareOverlays(drawHardwareOverlays);
// Apply camera engine params // Apply camera engine params
// Adding new ones? See setEngine(). // Adding new ones? See setEngine().
@ -605,6 +609,12 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
mGestureMap.get(Gesture.SCROLL_VERTICAL) != none); mGestureMap.get(Gesture.SCROLL_VERTICAL) != none);
break; break;
} }
mActiveGestures = 0;
for(GestureAction act : mGestureMap.values()) {
mActiveGestures += act == GestureAction.NONE ? 0 : 1;
}
return true; return true;
} }
mapGesture(gesture, none); mapGesture(gesture, none);
@ -633,7 +643,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
@Override @Override
public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) {
return true; // Steal our own events. // Steal our own events if gestures are enabled
return mActiveGestures > 0;
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
@ -2148,6 +2159,25 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
return mCameraEngine.isTakingPicture(); return mCameraEngine.isTakingPicture();
} }
/**
* Sets the overlay layout hardware canvas capture mode to allow hardware
* accelerated views to be captured in snapshots
*
* @param on true if enabled
*/
public void setDrawHardwareOverlays(boolean on) {
mOverlayLayout.setHardwareCanvasEnabled(on);
}
/**
* Returns true if the overlay layout is set to capture the hardware canvas
* of child views
*
* @return boolean indicating hardware canvas capture is enabled
*/
public boolean getDrawHardwareOverlays() {
return mOverlayLayout.getHardwareCanvasEnabled();
}
//endregion //endregion
//region Callbacks and dispatching //region Callbacks and dispatching

@ -590,9 +590,15 @@ public class Camera2Engine extends CameraBaseEngine implements
@Override @Override
public void onConfigureFailed(@NonNull CameraCaptureSession session) { public void onConfigureFailed(@NonNull CameraCaptureSession session) {
// This SHOULD be a library error so we throw a RuntimeException.
String message = LOG.e("onConfigureFailed! Session", session); String message = LOG.e("onConfigureFailed! Session", session);
throw new RuntimeException(message); Throwable cause = new RuntimeException(message);
if (!task.getTask().isComplete()) {
task.trySetException(new CameraException(cause,
CameraException.REASON_FAILED_TO_START_PREVIEW));
} else {
// Like onStartEngine.onError
throw new CameraException(CameraException.REASON_DISCONNECTED);
}
} }
@Override @Override

@ -23,6 +23,7 @@ public class FpsRangeValidator {
static { static {
sIssues.put("Google Pixel 4", Arrays.asList(new Range<>(15, 60))); sIssues.put("Google Pixel 4", Arrays.asList(new Range<>(15, 60)));
sIssues.put("Google Pixel 4a", Arrays.asList(new Range<>(15, 60)));
} }
public static boolean validate(Range<Integer> range) { public static boolean validate(Range<Integer> range) {

@ -30,4 +30,18 @@ public interface Overlay {
* @return true to draw on it * @return true to draw on it
*/ */
boolean drawsOn(@NonNull Target target); boolean drawsOn(@NonNull Target target);
/**
* Sets the overlay renderer to lock and capture the hardware canvas in order
* to capture hardware accelerated views such as video players
*
* @param on enabled
*/
void setHardwareCanvasEnabled(boolean on);
/**
* Returns true if hardware canvas capture is enabled, false by default
* @return true if capturing hardware surfaces
*/
boolean getHardwareCanvasEnabled();
} }

@ -6,6 +6,7 @@ import android.graphics.PorterDuff;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.opengl.GLES11Ext; import android.opengl.GLES11Ext;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.os.Build;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -63,7 +64,12 @@ public class OverlayDrawer {
*/ */
public void draw(@NonNull Overlay.Target target) { public void draw(@NonNull Overlay.Target target) {
try { try {
final Canvas surfaceCanvas = mSurface.lockCanvas(null); final Canvas surfaceCanvas;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && mOverlay.getHardwareCanvasEnabled()) {
surfaceCanvas = mSurface.lockHardwareCanvas();
} else {
surfaceCanvas = mSurface.lockCanvas(null);
}
surfaceCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); surfaceCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
mOverlay.drawOn(target, surfaceCanvas); mOverlay.drawOn(target, surfaceCanvas);
mSurface.unlockCanvasAndPost(surfaceCanvas); mSurface.unlockCanvasAndPost(surfaceCanvas);

@ -26,6 +26,8 @@ public class OverlayLayout extends FrameLayout implements Overlay {
@VisibleForTesting Target currentTarget = Target.PREVIEW; @VisibleForTesting Target currentTarget = Target.PREVIEW;
private boolean mHardwareCanvasEnabled;
/** /**
* We set {@link #setWillNotDraw(boolean)} to false even if we don't draw anything. * We set {@link #setWillNotDraw(boolean)} to false even if we don't draw anything.
* This ensures that the View system will call {@link #draw(Canvas)} on us instead * This ensures that the View system will call {@link #draw(Canvas)} on us instead
@ -99,6 +101,16 @@ public class OverlayLayout extends FrameLayout implements Overlay {
return false; return false;
} }
@Override
public void setHardwareCanvasEnabled(boolean on) {
mHardwareCanvasEnabled = on;
}
@Override
public boolean getHardwareCanvasEnabled() {
return mHardwareCanvasEnabled;
}
/** /**
* For {@link Target#PREVIEW}, this method is called by the View hierarchy. We will * For {@link Target#PREVIEW}, this method is called by the View hierarchy. We will
* just forward the call to super. * just forward the call to super.
@ -132,7 +144,8 @@ public class OverlayLayout extends FrameLayout implements Overlay {
"canvas:", canvas.getWidth() + "x" + canvas.getHeight(), "canvas:", canvas.getWidth() + "x" + canvas.getHeight(),
"view:", getWidth() + "x" + getHeight(), "view:", getWidth() + "x" + getHeight(),
"widthScale:", widthScale, "widthScale:", widthScale,
"heightScale:", heightScale "heightScale:", heightScale,
"hardwareCanvasMode:", mHardwareCanvasEnabled
); );
canvas.scale(widthScale, heightScale); canvas.scale(widthScale, heightScale);
dispatchDraw(canvas); dispatchDraw(canvas);

@ -169,6 +169,8 @@
<attr name="cameraRequestPermissions" format="boolean|reference"/> <attr name="cameraRequestPermissions" format="boolean|reference"/>
<attr name="cameraExperimental" format="boolean|reference" /> <attr name="cameraExperimental" format="boolean|reference" />
<attr name="cameraDrawHardwareOverlays" format="boolean"/>
</declare-styleable> </declare-styleable>
<declare-styleable name="CameraView_Layout"> <declare-styleable name="CameraView_Layout">

@ -18,6 +18,6 @@ android {
dependencies { dependencies {
implementation(project(":cameraview")) implementation(project(":cameraview"))
implementation("androidx.appcompat:appcompat:1.2.0") implementation("androidx.appcompat:appcompat:1.3.0")
implementation("com.google.android.material:material:1.2.0") implementation("com.google.android.material:material:1.4.0")
} }

@ -9,6 +9,15 @@ New versions are released through GitHub, so the reference page is the [GitHub R
> Starting from 2.4.0, you can now [support development](https://github.com/sponsors/natario1) through the GitHub Sponsors program. > Starting from 2.4.0, you can now [support development](https://github.com/sponsors/natario1) through the GitHub Sponsors program.
Companies can share a tiny part of their revenue and get private support hours in return. Thanks! Companies can share a tiny part of their revenue and get private support hours in return. Thanks!
##### v2.7.1
- Fix: fix preview issues on Pixel 4A with certain FPS, thanks to [@honzasmuk][honzasmuk] ([#1089][1089])
- Improvement: don't catch gestures if they're turned off, thanks to [@ObsidianX][ObsidianX] ([#1068][1068])
- New: new flag cameraDrawHardwareOverlays and setDrawHardwareOverlays() to draw overlays on hardware canvas, thanks to [@ObsidianX][ObsidianX] ([#1066][1066])
- Publish on Maven Central instead of JCenter
<https://github.com/natario1/CameraView/compare/v2.7.0...v2.7.1>
##### v2.7.0 ##### v2.7.0
- New: onPictureShutter() callback when taking pictures, thanks to [@EzequielAdrianM][EzequielAdrianM] ([#1030][1030]) - New: onPictureShutter() callback when taking pictures, thanks to [@EzequielAdrianM][EzequielAdrianM] ([#1030][1030])
@ -359,6 +368,8 @@ This is the last release before v2.
[jeffreyfjohnson]: https://github.com/jeffreyfjohnson [jeffreyfjohnson]: https://github.com/jeffreyfjohnson
[michaelspecht]: https://github.com/michaelspecht [michaelspecht]: https://github.com/michaelspecht
[EzequielAdrianM]: https://github.com/EzequielAdrianM [EzequielAdrianM]: https://github.com/EzequielAdrianM
[honzasmuk]: https://github.com/honzasmuk
[ObsidianX]: https://github.com/ObsidianX
[73]: https://github.com/natario1/CameraView/pull/73 [73]: https://github.com/natario1/CameraView/pull/73
@ -462,3 +473,6 @@ This is the last release before v2.
[1020]: https://github.com/natario1/CameraView/pull/1020 [1020]: https://github.com/natario1/CameraView/pull/1020
[1024]: https://github.com/natario1/CameraView/pull/1024 [1024]: https://github.com/natario1/CameraView/pull/1024
[1030]: https://github.com/natario1/CameraView/pull/1030 [1030]: https://github.com/natario1/CameraView/pull/1030
[1089]: https://github.com/natario1/CameraView/pull/1089
[1068]: https://github.com/natario1/CameraView/pull/1068
[1066]: https://github.com/natario1/CameraView/pull/1066

@ -87,7 +87,7 @@ and maintainers have had time to execute and publish the release. You can speed
[sponsoring the project](../extra/donate) or pull snapshots from [jitpack.io](https://jitpack.io): [sponsoring the project](../extra/donate) or pull snapshots from [jitpack.io](https://jitpack.io):
```groovy ```groovy
implementation 'com.github.natario1:CameraView:master-SNAPSHOT' implementation 'com.github.natario1:CameraView:main-SNAPSHOT'
implementation 'com.github.natario1:CameraView:<commit hash>' implementation 'com.github.natario1:CameraView:<commit hash>'
``` ```

@ -7,13 +7,13 @@ order: 1
The library works on API 15+, which is the only requirement and should be met by most projects nowadays. The library works on API 15+, which is the only requirement and should be met by most projects nowadays.
It is publicly hosted on [JCenter](https://bintray.com/natario/android/CameraView), where you It is publicly hosted on [Maven Central](https://repo.maven.apache.org/maven2/com/otaliastudios/cameraview), where you
can download the AAR package. To fetch with Gradle, make sure you add the JCenter repository in your root projects `build.gradle` file: can download the AAR package. To fetch with Gradle, make sure you add the Maven Central repository in your root projects `build.gradle` file:
```groovy ```groovy
allprojects { allprojects {
repositories { repositories {
jcenter() mavenCentral()
} }
} }
``` ```

@ -12,8 +12,8 @@ google_analytics_id: 'UA-155077779-1'
google_site_verification: '4x49i17ABIrSvUl52SeL0-t0341aTnWWaC62-FYCRT4' google_site_verification: '4x49i17ABIrSvUl52SeL0-t0341aTnWWaC62-FYCRT4'
github: [metadata] # TODO What's this? github: [metadata] # TODO What's this?
github_repo: CameraView github_repo: CameraView
github_version: 2.7.0 github_version: 2.7.1
github_branch: master github_branch: main
baseurl: '/CameraView' # Keep as an empty string if served up at the root baseurl: '/CameraView' # Keep as an empty string if served up at the root
collections: collections:
about: about:

@ -82,3 +82,19 @@ params.drawOnVideoSnapshot = false; // do not draw on video snapshots
// When done, apply // When done, apply
overlay.setLayoutParams(params); overlay.setLayoutParams(params);
``` ```
To capture a hardware rendered View such as a video rendered to a TextureView, enable the
`cameraDrawHardwareOverlays` flag:
```xml
<com.otaliastudios.cameraview.CameraView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cameraDrawHardwareOverlays="true"/>
```
Alternatively you can enable it in code with `setDrawHardwareOverlays()`:
```java
cameraView.setDrawHardwareOverlays(true);
```

@ -48,4 +48,4 @@ and [Google's CameraView](https://github.com/google/cameraview), but has been co
CameraKit's source code is licensed under the [MIT](https://github.com/wonderkiln/CameraKit-Android/blob/master/LICENSE) license. CameraKit's source code is licensed under the [MIT](https://github.com/wonderkiln/CameraKit-Android/blob/master/LICENSE) license.
CameraView is licensed under the [MIT](https://github.com/natario1/CameraView/blob/master/LICENSE) license as well. CameraView is licensed under the [MIT](https://github.com/natario1/CameraView/blob/main/LICENSE) license as well.

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip

Loading…
Cancel
Save