Error when camera permission denied

This commit is contained in:
MrLetsplay 2023-10-03 21:10:06 +02:00
parent aa16178a78
commit 2347f9c57e
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
2 changed files with 10 additions and 0 deletions

View File

@ -83,6 +83,15 @@ public class QRScannerActivity extends BaseActivity {
scanner = new QRScanner();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode == 1234 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
error(getString(R.string.error_no_camera_permission));
}
}
void bindPreview(@NonNull ProcessCameraProvider cameraProvider) {
Preview preview = new Preview.Builder()
.build();

View File

@ -149,6 +149,7 @@
<string name="error_qr_scan_image_failed">"Failed to read image: "</string>
<string name="icon_pack_exists_title">Icon pack already exists</string>
<string name="error_import_icon_pack">Failed to import icon pack</string>
<string name="error_no_camera_permission">No camera permission</string>
<string-array name="edit_otp_choose_image_options">
<item>Image from icon pack</item>
<item>Image from gallery</item>