mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Force higher resolution for analysis and run it on a background thread
This commit is contained in:
parent
22c93bf5c6
commit
7be1a74cfd
5 changed files with 49 additions and 18 deletions
|
@ -1,6 +1,9 @@
|
|||
package com.beemdevelopment.aegis.helpers;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.util.Size;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.camera.core.ImageAnalysis;
|
||||
|
@ -23,6 +26,7 @@ import static android.graphics.ImageFormat.YUV_444_888;
|
|||
|
||||
public class QrCodeAnalyzer implements ImageAnalysis.Analyzer {
|
||||
private static final String TAG = QrCodeAnalyzer.class.getSimpleName();
|
||||
public static final Size RESOLUTION = new Size(1200, 1600);
|
||||
|
||||
private final QrCodeAnalyzer.Listener _listener;
|
||||
|
||||
|
@ -53,7 +57,7 @@ public class QrCodeAnalyzer implements ImageAnalysis.Analyzer {
|
|||
try {
|
||||
Result result = reader.decode(bitmap);
|
||||
if (_listener != null) {
|
||||
_listener.onQrCodeDetected(result);
|
||||
new Handler(Looper.getMainLooper()).post(() -> _listener.onQrCodeDetected(result));
|
||||
}
|
||||
} catch (ChecksumException | FormatException | NotFoundException ignored) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue