Show generic zxing errors on the camera error screen

This commit is contained in:
Sylvia van Os
2024-06-04 18:10:14 +02:00
parent a6b7b227f7
commit d1b93018e3
2 changed files with 24 additions and 10 deletions

View File

@@ -4,22 +4,24 @@ import android.app.Activity;
import android.content.Context;
import android.widget.Toast;
import androidx.core.util.Consumer;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
public class CatimaCaptureManager extends CaptureManager {
private final Context mContext;
private final Consumer<String> mErrorCallback;
public CatimaCaptureManager(Activity activity, DecoratedBarcodeView barcodeView) {
public CatimaCaptureManager(Activity activity, DecoratedBarcodeView barcodeView, Consumer<String> errorCallback) {
super(activity, barcodeView);
mContext = activity.getApplicationContext();
mErrorCallback = errorCallback;
}
@Override
protected void displayFrameworkBugMessageAndExit(String message) {
// We don't want to exit, as we also have a enter from card image and add manually button here
// So we show a toast instead
Toast.makeText(mContext, message, Toast.LENGTH_LONG).show();
// So, instead, we call our error callback
mErrorCallback.accept(message);
}
}