mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11:30 +00:00
This commit is contained in:
parent
517c5ca73d
commit
733f873ae3
1 changed files with 10 additions and 4 deletions
|
@ -44,12 +44,17 @@ public class QRScannerActivity extends ThemedAppCompatActivity implements Barcod
|
||||||
this.barcodeView = findViewById(R.id.bar_code_scanner_view);
|
this.barcodeView = findViewById(R.id.bar_code_scanner_view);
|
||||||
|
|
||||||
findViewById(R.id.cancel_button).setOnClickListener(view -> {
|
findViewById(R.id.cancel_button).setOnClickListener(view -> {
|
||||||
pauseScanner();
|
finishScanning();
|
||||||
finish();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
checkPermissionAndStartScanner();
|
checkPermissionAndStartScanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
finishScanning();
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region === Permissions Callback ===
|
// region === Permissions Callback ===
|
||||||
|
@ -72,7 +77,7 @@ public class QRScannerActivity extends ThemedAppCompatActivity implements Barcod
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(QR_RESULT_ARG, code);
|
intent.putExtra(QR_RESULT_ARG, code);
|
||||||
setResult(Activity.RESULT_OK, intent);
|
setResult(Activity.RESULT_OK, intent);
|
||||||
finish();
|
finishScanning();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,8 +101,9 @@ public class QRScannerActivity extends ThemedAppCompatActivity implements Barcod
|
||||||
this.barcodeView.decodeSingle(this);
|
this.barcodeView.decodeSingle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pauseScanner() {
|
private void finishScanning() {
|
||||||
this.barcodeView.pause();
|
this.barcodeView.pause();
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue