Skip to content

Commit 90f1dd2

Browse files
committed
pause scanner when showing hints
1 parent 86bef73 commit 90f1dd2

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ui/src/main/java/io/snabble/sdk/ui/scanner/SelfScanningView.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class SelfScanningView extends CoordinatorLayout implements Checkout.OnCh
5959
private boolean allowShowingHints;
6060
private TextView info;
6161
private Handler infoHandler = new Handler(Looper.getMainLooper());
62+
private boolean isShowingHint;
6263

6364
public SelfScanningView(Context context) {
6465
super(context);
@@ -152,7 +153,10 @@ public void onBarcodeDetected(final Barcode barcode) {
152153
productDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
153154
@Override
154155
public void onDismiss(DialogInterface dialog) {
155-
resumeBarcodeScanner();
156+
if(!isShowingHint) {
157+
resumeBarcodeScanner();
158+
}
159+
156160
allowScan = true;
157161
}
158162
});
@@ -348,18 +352,27 @@ private void showHints() {
348352
Shop currentShop = project.getCheckout().getShop();
349353

350354
if (currentShop != null) {
355+
pauseBarcodeScanner();
356+
351357
Context context = getContext();
352358

353359
final AlertDialog alertDialog = new AlertDialog.Builder(context)
354360
.setTitle(context.getString(R.string.Snabble_Hints_title, currentShop.getName()))
355361
.setMessage(context.getString(R.string.Snabble_Hints_closedBags))
356362
.setPositiveButton(R.string.Snabble_OK, null)
357363
.setCancelable(true)
364+
.setOnDismissListener(new DialogInterface.OnDismissListener() {
365+
@Override
366+
public void onDismiss(DialogInterface dialog) {
367+
resumeBarcodeScanner();
368+
isShowingHint = false;
369+
}
370+
})
358371
.create();
359372

360373
alertDialog.setCanceledOnTouchOutside(true);
361-
362374
alertDialog.show();
375+
isShowingHint = true;
363376
}
364377
}
365378
}

0 commit comments

Comments
 (0)