This commit is contained in:
Jenly
2020-04-28 22:29:44 +08:00
parent 282c3dc39e
commit 4d607cf849
5 changed files with 28 additions and 27 deletions

View File

@@ -22,7 +22,6 @@ import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.RectF;
import android.hardware.Camera;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -526,19 +525,18 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
return;
}
if(isPlayBeep){//如果播放音效,则稍微延迟一点,给予播放音效时间
if(captureHandler != null){
captureHandler.postDelayed(() -> {
//如果设置了回调并且onCallback返回为true则表示拦截
if(onCaptureCallback!=null && onCaptureCallback.onResultCallback(text)){
return;
}
Intent intent = new Intent();
intent.putExtra(Intents.Scan.RESULT,text);
activity.setResult(Activity.RESULT_OK,intent);
activity.finish();
},100);
}
if(isPlayBeep && captureHandler != null){//如果播放音效,则稍微延迟一点,给予播放音效时间
captureHandler.postDelayed(() -> {
//如果设置了回调并且onCallback返回为true则表示拦截
if(onCaptureCallback!=null && onCaptureCallback.onResultCallback(text)){
return;
}
Intent intent = new Intent();
intent.putExtra(Intents.Scan.RESULT,text);
activity.setResult(Activity.RESULT_OK,intent);
activity.finish();
},100);
return;
}