Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated camerax #20

Merged
merged 2 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ ext {
version_appcompat : "1.1.0",
localbroadcastmanager : "1.0.0",

camerax_view : "1.0.0-alpha10",
camerax_version : "1.0.0-beta03",
camera_core_version : "1.0.0-beta03",
camerax_view : "1.0.0-alpha14",
camerax_version : "1.0.0-beta07",
camera_core_version : "1.0.0-beta07",
futures_version : "1.0.0",

// ucrop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.widget.Button;
import android.widget.TextView;

import com.google.common.util.concurrent.ListenableFuture;
import com.luck.picture.lib.camera.CustomCameraView;
import com.luck.picture.lib.camera.listener.CameraListener;
import com.luck.picture.lib.camera.view.CaptureLayout;
Expand All @@ -27,6 +28,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.camera.core.CameraX;
import androidx.camera.lifecycle.ProcessCameraProvider;
import androidx.camera.view.CameraView;

/**
Expand Down Expand Up @@ -205,16 +207,6 @@ public void onBackPressed() {
closeActivity();
}

@SuppressLint("RestrictedApi")
@Override
protected void onDestroy() {
if (mCameraView != null) {
CameraX.unbindAll();
mCameraView = null;
}
super.onDestroy();
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.camera.core.ImageCapture;
import androidx.camera.core.ImageCapture.OutputFileOptions;
import androidx.camera.core.ImageCaptureException;
import androidx.camera.core.VideoCapture;
import androidx.camera.view.CameraView;
Expand Down Expand Up @@ -136,7 +137,8 @@ public void takePictures() {
return;
}
mPhotoFile = imageOutFile;
mCameraView.takePicture(imageOutFile, ContextCompat.getMainExecutor(getContext()),
ImageCapture.OutputFileOptions options = new ImageCapture.OutputFileOptions.Builder(imageOutFile).build();
mCameraView.takePicture(options, ContextCompat.getMainExecutor(getContext()),
new MyImageResultCallback(getContext(), mConfig, imageOutFile,
mImagePreview, mCaptureLayout, mImageCallbackListener, mCameraListener));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void takePictures() {
}
mCameraView.setCaptureMode(androidx.camera.view.CameraView.CaptureMode.IMAGE);
File imageOutFile = createImageFile();
mCameraView.takePicture(imageOutFile, ContextCompat.getMainExecutor(getContext().getApplicationContext()), new OnImageSavedCallbackImpl(InstagramCameraView.this, imageOutFile));
ImageCapture.OutputFileOptions options = new ImageCapture.OutputFileOptions.Builder(imageOutFile).build();
mCameraView.takePicture(options, ContextCompat.getMainExecutor(getContext().getApplicationContext()), new OnImageSavedCallbackImpl(InstagramCameraView.this, imageOutFile));
}

@Override
Expand Down