Skip to content

Commit

Permalink
Merge pull request #20 from tallot13/master
Browse files Browse the repository at this point in the history
Updated camerax
  • Loading branch information
JessYanCoding committed Aug 11, 2020
2 parents 71341e0 + 0610ffb commit 1b0762b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
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

0 comments on commit 1b0762b

Please sign in to comment.