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

fix: 解决拍照按钮快速连续点击导致的异常 #1382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PreviewState implements State {
public static final String TAG = "PreviewState";

private CameraMachine machine;
private boolean capturing = false;

PreviewState(CameraMachine machine) {
this.machine = machine;
Expand Down Expand Up @@ -46,6 +47,12 @@ public void switchCamera(SurfaceHolder holder, float screenProp) {
@Override
public void capture() {
TUIChatLog.i(TAG, "capture");

if (capturing) {
return;
}

capturing = true;
CameraInterface.getInstance().takePicture(new CameraInterface.TakePictureCallback() {
@Override
public void captureResult(Bitmap bitmap, boolean isVertical) {
Expand All @@ -57,6 +64,7 @@ public void captureResult(Bitmap bitmap, boolean isVertical) {
machine.getCameraView().showPicture(bitmap, isVertical);
machine.getBrowserPictureState().setDataPath(path);
machine.setState(machine.getBrowserPictureState());
capturing = false;
}
});
}
Expand Down