v2.0.0-beta03 (#392)

* Fix #377 and update dependencies

* Fix #384

* Fix unbindFromSurface bug

* Bump version to v2.0.0-beta03

* Update build.gradle
pull/402/head v2.0.0-beta03
Mattia Iavarone 6 years ago committed by GitHub
parent 7411614433
commit d462b83048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 2
      cameraview/build.gradle
  3. 19
      cameraview/src/main/gles/com/otaliastudios/cameraview/EglCore.java
  4. 29
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java
  5. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
  6. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  7. 4
      demo/build.gradle
  8. 4
      demo/src/main/AndroidManifest.xml
  9. 9
      docs/_posts/2018-12-20-changelog.md
  10. 2
      docs/_posts/2018-12-20-install.md

@ -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.
```groovy
compile 'com.otaliastudios:cameraview:2.0.0-beta02'
compile 'com.otaliastudios:cameraview:2.0.0-beta03'
```
- Fast & reliable

@ -3,7 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
// Required by bintray
version = '2.0.0-beta02'
version = '2.0.0-beta03'
group = 'com.otaliastudios'
//region android dependencies

@ -137,7 +137,7 @@ final class EglCore {
int[] values = new int[1];
EGL14.eglQueryContext(mEGLDisplay, mEGLContext, EGL14.EGL_CONTEXT_CLIENT_VERSION,
values, 0);
Log.d(TAG, "EGLContext created, client version " + values[0]);
// Log.d(TAG, "EGLContext created, client version " + values[0]);
}
/**
@ -273,7 +273,7 @@ final class EglCore {
public void makeCurrent(EGLSurface eglSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
// Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
@ -351,21 +351,6 @@ final class EglCore {
return mGlVersion;
}
/**
* Writes the current display, context, and surface to the log.
*/
public static void logCurrent(String msg) {
EGLDisplay display;
EGLContext context;
EGLSurface surface;
display = EGL14.eglGetCurrentDisplay();
context = EGL14.eglGetCurrentContext();
surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
", surface=" + surface);
}
/**
* Checks for EGL errors. Throws an exception if an error has been raised.
*/

@ -66,7 +66,10 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
});
}
// Preview surface is now available. If camera is open, set up.
/**
* Preview surface is now available. If camera is open, set up.
* At this point we are sure that mPreview is not null.
*/
@Override
public void onSurfaceAvailable() {
LOG.i("onSurfaceAvailable:", "Size is", mPreview.getOutputSurfaceSize());
@ -80,8 +83,11 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
});
}
// Preview surface did change its size. Compute a new preview size.
// This requires stopping and restarting the preview.
/**
* Preview surface did change its size. Compute a new preview size.
* This requires stopping and restarting the preview.
* At this point we are sure that mPreview is not null.
*/
@Override
public void onSurfaceChanged() {
LOG.i("onSurfaceChanged, size is", mPreview.getOutputSurfaceSize());
@ -119,8 +125,11 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
return isCameraAvailable() && mPreview != null && mPreview.hasSurface() && !mIsBound;
}
// The act of binding an "open" camera to a "ready" preview.
// These can happen at different times but we want to end up here.
/**
* The act of binding an "open" camera to a "ready" preview.
* These can happen at different times but we want to end up here.
* At this point we are sure that mPreview is not null.
*/
@WorkerThread
private void bindToSurface() {
LOG.i("bindToSurface:", "Started");
@ -275,7 +284,7 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
}
if (mCamera != null) {
stopPreview();
unbindFromSurface();
if (mIsBound) unbindFromSurface();
destroyCamera();
}
mCameraOptions = null;
@ -440,8 +449,12 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(mCameraId, info);
if (info.canDisableShutterSound) {
mCamera.enableShutterSound(mPlaySounds);
return true;
try {
// this method is documented to throw on some occasions. #377
return mCamera.enableShutterSound(mPlaySounds);
} catch (RuntimeException exception) {
return false;
}
}
}
if (mPlaySounds) {

@ -91,7 +91,7 @@ abstract class CameraController implements
mFrameManager = new FrameManager(2, this);
}
void setPreview(CameraPreview cameraPreview) {
void setPreview(@NonNull CameraPreview cameraPreview) {
mPreview = cameraPreview;
mPreview.setSurfaceCallback(this);
}

@ -602,7 +602,6 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
public void open() {
if (!isEnabled()) return;
if (mCameraPreview != null) mCameraPreview.onResume();
if (checkPermissions(getAudio())) {
// Update display orientation for current CameraController
mOrientationHelper.enable(getContext());

@ -23,6 +23,6 @@ android {
dependencies {
implementation project(':cameraview')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha03'
}

@ -15,9 +15,9 @@
<activity
android:name=".CameraActivity"
android:theme="@style/Theme.MainActivity"
android:hardwareAccelerated="true"
android:configChanges="orientation|screenLayout|keyboardHidden"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

@ -8,6 +8,11 @@ order: 3
New versions are released through GitHub, so the reference page is the [GitHub Releases](https://github.com/natario1/CameraView/releases) page.
### v2.0.0-beta03
- Fixed a few bugs ([#392][392])
- Important fixes to video snapshot recording ([#374][374])
### v2.0.0-beta02
- Fixed important bugs ([#356][356])
@ -19,4 +24,6 @@ New versions are released through GitHub, so the reference page is the [GitHub R
This is the first beta release. For changes with respect to v1, please take a look at the [migration guide](../extra/v1-migration-guide.html).
[356]: https://github.com/natario1/CameraView/pull/356
[360]: https://github.com/natario1/CameraView/pull/360
[360]: https://github.com/natario1/CameraView/pull/360
[374]: https://github.com/natario1/CameraView/pull/374
[392]: https://github.com/natario1/CameraView/pull/392

@ -24,7 +24,7 @@ allprojects {
Then simply download the latest version:
```groovy
api 'com.otaliastudios:cameraview:2.0.0-beta02'
api 'com.otaliastudios:cameraview:2.0.0-beta03'
```
No other configuration steps are needed.
Loading…
Cancel
Save