From d8d2f5fec4ab9a472cf7664e7b8a03adc46526cd Mon Sep 17 00:00:00 2001 From: Kolya Opahle Date: Tue, 30 Mar 2021 18:21:27 +0200 Subject: [PATCH] Create QR Code Scan Screen (EXPOSUREAPP-5742) (#2697) * the qr code scan screen style is now shared between test and event scan screen as of now layouts are still separate files, may condense later * Removed transitionName from fragment_scan_check_in_qr_code and fragment_submission_qr_code_scan * Readded missing transitionName to fragment_scan_check_in_qr_code * Reverting changes to all translated strings * Re added the old string keys to default file to allow linting to pass (should be overwritten by translation) Co-authored-by: harambasicluka <64483219+harambasicluka@users.noreply.github.com> --- .../scan/ScanCheckInQrCodeFragment.kt | 3 +- .../scan/SubmissionQRCodeScanFragment.kt | 24 +-- .../layout/fragment_scan_check_in_qr_code.xml | 79 ++++----- .../fragment_submission_qr_code_scan.xml | 164 ++++++++---------- .../src/main/res/values-de/strings.xml | 4 +- .../src/main/res/values-night/colors.xml | 3 + .../src/main/res/values/colors.xml | 4 + .../src/main/res/values/dimens.xml | 6 +- .../src/main/res/values/strings.xml | 6 +- .../src/main/res/values/styles.xml | 6 +- 10 files changed, 134 insertions(+), 165 deletions(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/eventregistration/attendee/scan/ScanCheckInQrCodeFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/eventregistration/attendee/scan/ScanCheckInQrCodeFragment.kt index 8e1ee327a92..1b7e90e6585 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/eventregistration/attendee/scan/ScanCheckInQrCodeFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/eventregistration/attendee/scan/ScanCheckInQrCodeFragment.kt @@ -50,7 +50,8 @@ class ScanCheckInQrCodeFragment : checkInQrCodeScanTorch.setOnCheckedChangeListener { _, isChecked -> binding.checkInQrCodeScanPreview.setTorch(isChecked) } - checkInQrCodeScanClose.setOnClickListener { viewModel.onNavigateUp() } + + checkInQrCodeScanToolbar.setNavigationOnClickListener { viewModel.onNavigateUp() } checkInQrCodeScanPreview.decoderFactory = DefaultDecoderFactory(listOf(BarcodeFormat.QR_CODE)) checkInQrCodeScanViewfinderView.setCameraPreview(binding.checkInQrCodeScanPreview) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanFragment.kt index e3659a896f9..6a26df16cb3 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanFragment.kt @@ -45,20 +45,22 @@ class SubmissionQRCodeScanFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - binding.submissionQrCodeScanTorch.setOnCheckedChangeListener { _, isChecked -> - binding.submissionQrCodeScanPreview.setTorch( - isChecked - ) - } + with(binding) { + submissionQrCodeScanTorch.setOnCheckedChangeListener { _, isChecked -> + binding.submissionQrCodeScanPreview.setTorch( + isChecked + ) + } - binding.submissionQrCodeScanClose.setOnClickListener { - viewModel.onClosePressed() - } + submissionQrCodeScanToolbar.setNavigationOnClickListener { + viewModel.onClosePressed() + } - binding.submissionQrCodeScanPreview.decoderFactory = - DefaultDecoderFactory(listOf(BarcodeFormat.QR_CODE)) + submissionQrCodeScanPreview.decoderFactory = + DefaultDecoderFactory(listOf(BarcodeFormat.QR_CODE)) - binding.submissionQrCodeScanViewfinderView.setCameraPreview(binding.submissionQrCodeScanPreview) + submissionQrCodeScanViewfinderView.setCameraPreview(binding.submissionQrCodeScanPreview) + } viewModel.scanStatusValue.observe2(this) { if (ScanStatus.INVALID == it) { diff --git a/Corona-Warn-App/src/main/res/layout/fragment_scan_check_in_qr_code.xml b/Corona-Warn-App/src/main/res/layout/fragment_scan_check_in_qr_code.xml index b14d08f71b9..80845bfcf21 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_scan_check_in_qr_code.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_scan_check_in_qr_code.xml @@ -4,7 +4,7 @@ android:id="@+id/check_in_qr_code_scan_container" android:layout_width="match_parent" android:layout_height="match_parent" - android:contentDescription="@string/submission_qr_code_scan_title" + android:contentDescription="@string/qr_code_scan_body" android:transitionName="shared_element_container"> + app:zxing_framing_rect_height="@dimen/scan_qr_code_viewfinder_size" + app:zxing_framing_rect_width="@dimen/scan_qr_code_viewfinder_size"> @@ -28,62 +28,45 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + app:zxing_viewfinder_mask="@color/colorQrCodeScanMask" app:zxing_viewfinder_laser_visibility="false" /> - - - + - + - - - + - - \ No newline at end of file diff --git a/Corona-Warn-App/src/main/res/layout/fragment_submission_qr_code_scan.xml b/Corona-Warn-App/src/main/res/layout/fragment_submission_qr_code_scan.xml index cba9a2bb359..2067ff633f6 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_submission_qr_code_scan.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_submission_qr_code_scan.xml @@ -1,113 +1,87 @@ - + android:id="@+id/submission_qr_code_scan_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:contentDescription="@string/qr_code_scan_body"> - - - - - + - + - + - + + - - - - - + - - + android:textOn="" /> - + - + - - \ No newline at end of file + \ No newline at end of file diff --git a/Corona-Warn-App/src/main/res/values-de/strings.xml b/Corona-Warn-App/src/main/res/values-de/strings.xml index 0032107c972..0f81d2553fb 100644 --- a/Corona-Warn-App/src/main/res/values-de/strings.xml +++ b/Corona-Warn-App/src/main/res/values-de/strings.xml @@ -1000,9 +1000,9 @@ "Abbrechen" - "Positionieren Sie den QR-Code in den Rahmen." + "QR-Code Scan" - "Positionieren Sie den QR-Code in den Rahmen." + "Positionieren Sie den QR-Code in den Rahmen." diff --git a/Corona-Warn-App/src/main/res/values-night/colors.xml b/Corona-Warn-App/src/main/res/values-night/colors.xml index 4968d680946..5048bc35d9f 100644 --- a/Corona-Warn-App/src/main/res/values-night/colors.xml +++ b/Corona-Warn-App/src/main/res/values-night/colors.xml @@ -73,4 +73,7 @@ #434445 #000000 + + #FFFFFF + #BF000000 diff --git a/Corona-Warn-App/src/main/res/values/colors.xml b/Corona-Warn-App/src/main/res/values/colors.xml index 5664ee9df9e..0fbe04067f6 100644 --- a/Corona-Warn-App/src/main/res/values/colors.xml +++ b/Corona-Warn-App/src/main/res/values/colors.xml @@ -95,6 +95,10 @@ #F5F5F5 + + #000000 + #BFFFFFFF + #EB4D3D diff --git a/Corona-Warn-App/src/main/res/values/dimens.xml b/Corona-Warn-App/src/main/res/values/dimens.xml index 5a07565d1eb..5dfb514085d 100644 --- a/Corona-Warn-App/src/main/res/values/dimens.xml +++ b/Corona-Warn-App/src/main/res/values/dimens.xml @@ -118,9 +118,9 @@ 6dp 16dp - - 240dp - 120dp + + 300dp + 150dp 40dp diff --git a/Corona-Warn-App/src/main/res/values/strings.xml b/Corona-Warn-App/src/main/res/values/strings.xml index 1e67ae2a1f1..04a964dc388 100644 --- a/Corona-Warn-App/src/main/res/values/strings.xml +++ b/Corona-Warn-App/src/main/res/values/strings.xml @@ -1008,8 +1008,12 @@ "Cancel" - "Position the QR code in the frame." + "QR-Code Scan" + "Position the QR code in the frame." + + + "QR-Code Scan" "Position the QR code in the frame." diff --git a/Corona-Warn-App/src/main/res/values/styles.xml b/Corona-Warn-App/src/main/res/values/styles.xml index 29a4b90e1d6..dfb4d908eef 100644 --- a/Corona-Warn-App/src/main/res/values/styles.xml +++ b/Corona-Warn-App/src/main/res/values/styles.xml @@ -391,11 +391,11 @@ -