mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-22 22:08:08 -05:00
Show generic zxing errors on the camera error screen
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user