diff --git a/CHANGELOG.md b/CHANGELOG.md index 77285e711..8031ccc99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Changes: - Add theming colour support (thanks, Subhashish Anand!) +- Don't close scan activity on camera error (so manual entry is still possible) ## v2.3.0 (2021-08-19) diff --git a/app/src/main/java/protect/card_locker/CatimaCaptureManager.java b/app/src/main/java/protect/card_locker/CatimaCaptureManager.java new file mode 100644 index 000000000..bff294749 --- /dev/null +++ b/app/src/main/java/protect/card_locker/CatimaCaptureManager.java @@ -0,0 +1,24 @@ +package protect.card_locker; + +import android.app.Activity; +import android.widget.Toast; + +import com.journeyapps.barcodescanner.CaptureManager; +import com.journeyapps.barcodescanner.DecoratedBarcodeView; + +public class CatimaCaptureManager extends CaptureManager { + private Activity activity; + + public CatimaCaptureManager(Activity activity, DecoratedBarcodeView barcodeView) { + super(activity, barcodeView); + + this.activity = activity; + } + + @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(activity, message, Toast.LENGTH_LONG).show(); + } +} diff --git a/app/src/main/java/protect/card_locker/ScanActivity.java b/app/src/main/java/protect/card_locker/ScanActivity.java index e2dd9107c..3b6917962 100644 --- a/app/src/main/java/protect/card_locker/ScanActivity.java +++ b/app/src/main/java/protect/card_locker/ScanActivity.java @@ -68,7 +68,7 @@ public class ScanActivity extends CatimaAppCompatActivity { // Even though we do the actual decoding with the barcodeScannerView // CaptureManager needs to be running to show the camera and scanning bar - capture = new CaptureManager(this, barcodeScannerView); + capture = new CatimaCaptureManager(this, barcodeScannerView); Intent captureIntent = new Intent(); Bundle captureIntentBundle = new Bundle(); captureIntentBundle.putBoolean(Intents.Scan.BEEP_ENABLED, false); @@ -146,8 +146,7 @@ public class ScanActivity extends CatimaAppCompatActivity { setResult(Activity.RESULT_CANCELED); finish(); return true; - } else if (item.getItemId() == R.id.action_toggle_flashlight) - { + } else if (item.getItemId() == R.id.action_toggle_flashlight) { if (torch) { torch = false; barcodeScannerView.setTorchOff();