Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Create QR Code Scan Screen (EXPOSUREAPP-5742) (#2697)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kolyaopahle and harambasicluka authored Mar 30, 2021
1 parent 6b98eca commit d8d2f5f
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<com.journeyapps.barcodescanner.BarcodeView
Expand All @@ -15,8 +15,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:zxing_framing_rect_height="@dimen/submission_scan_qr_code_viewfinder_size"
app:zxing_framing_rect_width="@dimen/submission_scan_qr_code_viewfinder_size">
app:zxing_framing_rect_height="@dimen/scan_qr_code_viewfinder_size"
app:zxing_framing_rect_width="@dimen/scan_qr_code_viewfinder_size">

</com.journeyapps.barcodescanner.BarcodeView>

Expand All @@ -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" />

<TextView
android:id="@+id/check_in_qr_code_scan_body"
style="@style/registrationQRCodeScanBody"
android:layout_width="@dimen/submission_scan_qr_code_viewfinder_size"
style="@style/qrCodeScanBody"
android:layout_width="@dimen/scan_qr_code_viewfinder_size"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/submission_scan_qr_code_viewfinder_center_offset"
android:text="@string/submission_qr_code_scan_body"
android:layout_marginTop="@dimen/scan_qr_code_viewfinder_center_offset"
android:text="@string/qr_code_scan_body"
app:layout_constraintEnd_toEndOf="@id/check_in_qr_code_scan_preview"
app:layout_constraintStart_toStartOf="@id/check_in_qr_code_scan_preview"
app:layout_constraintTop_toBottomOf="@id/check_in_qr_code_scan_guideline_center" />


<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/check_in_qr_code_scan_close"
style="@style/buttonIcon"
android:layout_width="@dimen/icon_size_button"
android:layout_height="@dimen/icon_size_button"
app:layout_constraintBottom_toTopOf="@id/check_in_qr_code_scan_guideline_top"
app:layout_constraintEnd_toStartOf="@id/guideline_start"
app:layout_constraintStart_toStartOf="@id/guideline_start"
app:layout_constraintTop_toTopOf="@id/check_in_qr_code_scan_guideline_top">

<androidx.appcompat.widget.AppCompatImageView
style="@style/iconStable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/accessibility_close"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_close" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/check_in_qr_code_scan_toolbar"
style="@style/CWAToolbar.BackArrow.Transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navigationIconTint="@color/colorQrCodeScanToolbar"
app:title="@string/qr_code_scan_title"
app:titleTextColor="@color/colorQrCodeScanToolbar">

</androidx.constraintlayout.widget.ConstraintLayout>
<ToggleButton
android:id="@+id/check_in_qr_code_scan_torch"
android:layout_width="@dimen/icon_size_button"
android:layout_height="@dimen/icon_size_button"
android:layout_gravity="end"
android:layout_marginEnd="@dimen/spacing_tiny"
android:background="@drawable/ic_registration_qr_code_scan_torch_toggle"
android:backgroundTint="@color/colorQrCodeScanToolbar"
android:textOff=""
android:textOn="" />

<ToggleButton
android:id="@+id/check_in_qr_code_scan_torch"
android:layout_width="@dimen/icon_size_button"
android:layout_height="@dimen/icon_size_button"
android:background="@drawable/ic_registration_qr_code_scan_torch_toggle"
android:backgroundTint="@color/colorStableLight"
android:textOff=""
android:textOn=""
app:layout_constraintBottom_toTopOf="@id/check_in_qr_code_scan_guideline_top"
app:layout_constraintEnd_toStartOf="@id/guideline_end"
app:layout_constraintStart_toStartOf="@id/guideline_end"
app:layout_constraintTop_toTopOf="@id/check_in_qr_code_scan_guideline_top" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/check_in_qr_code_scan_guideline_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="@dimen/spacing_normal" />
</com.google.android.material.appbar.MaterialToolbar>

<androidx.constraintlayout.widget.Guideline
android:id="@+id/check_in_qr_code_scan_guideline_center"
Expand All @@ -92,6 +75,4 @@
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

<include layout="@layout/merge_guidelines_side" />

</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
@@ -1,113 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
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">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/submission_qr_code_scan_container"
android:contentDescription="@string/submission_qr_code_scan_title"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.journeyapps.barcodescanner.BarcodeView
android:id="@+id/submission_qr_code_scan_preview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:zxing_framing_rect_height="@dimen/submission_scan_qr_code_viewfinder_size"
app:zxing_framing_rect_width="@dimen/submission_scan_qr_code_viewfinder_size">

</com.journeyapps.barcodescanner.BarcodeView>
<com.journeyapps.barcodescanner.BarcodeView
android:id="@+id/submission_qr_code_scan_preview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:zxing_framing_rect_height="@dimen/scan_qr_code_viewfinder_size"
app:zxing_framing_rect_width="@dimen/scan_qr_code_viewfinder_size">

<com.journeyapps.barcodescanner.ViewfinderView
android:id="@+id/submission_qr_code_scan_viewfinder_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:zxing_viewfinder_laser_visibility="false" />
</com.journeyapps.barcodescanner.BarcodeView>

<TextView
android:id="@+id/submission_qr_code_scan_body"
style="@style/registrationQRCodeScanBody"
android:layout_width="@dimen/submission_scan_qr_code_viewfinder_size"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/submission_scan_qr_code_viewfinder_center_offset"
android:text="@string/submission_qr_code_scan_body"
app:layout_constraintEnd_toEndOf="@+id/submission_qr_code_scan_preview"
app:layout_constraintStart_toStartOf="@+id/submission_qr_code_scan_preview"
app:layout_constraintTop_toBottomOf="@+id/submission_qr_code_scan_guideline_center" />
<com.journeyapps.barcodescanner.ViewfinderView
android:id="@+id/submission_qr_code_scan_viewfinder_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:zxing_viewfinder_laser_visibility="false"
app:zxing_viewfinder_mask="@color/colorQrCodeScanMask" />

<ProgressBar
android:id="@+id/submission_qr_code_scan_spinner"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/submission_qr_code_scan_body"
app:layout_constraintStart_toStartOf="@+id/submission_qr_code_scan_body"
app:layout_constraintTop_toBottomOf="@+id/submission_qr_code_scan_body" />
<TextView
android:id="@+id/submission_qr_code_scan_body"
style="@style/qrCodeScanBody"
android:layout_width="@dimen/scan_qr_code_viewfinder_size"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/scan_qr_code_viewfinder_center_offset"
android:text="@string/qr_code_scan_body"
app:layout_constraintEnd_toEndOf="@id/submission_qr_code_scan_preview"
app:layout_constraintStart_toStartOf="@id/submission_qr_code_scan_preview"
app:layout_constraintTop_toBottomOf="@id/submission_qr_code_scan_guideline_center" />

<ProgressBar
android:id="@+id/submission_qr_code_scan_spinner"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/submission_qr_code_scan_body"
app:layout_constraintStart_toStartOf="@+id/submission_qr_code_scan_body"
app:layout_constraintTop_toBottomOf="@+id/submission_qr_code_scan_body" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/submission_qr_code_scan_close"
style="@style/buttonIcon"
android:layout_width="@dimen/icon_size_button"
android:layout_height="@dimen/icon_size_button"
app:layout_constraintBottom_toTopOf="@+id/submission_qr_code_scan_guideline_top"
app:layout_constraintEnd_toStartOf="@+id/guideline_start"
app:layout_constraintStart_toStartOf="@+id/guideline_start"
app:layout_constraintTop_toTopOf="@+id/submission_qr_code_scan_guideline_top">

<ImageView
style="@style/iconStable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
bind:cwaContentDescription="@{@string/accessibility_close}"
android:src="@drawable/ic_close"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />

</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/submission_qr_code_scan_toolbar"
style="@style/CWAToolbar.BackArrow.Transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navigationIconTint="@color/colorQrCodeScanToolbar"
app:title="@string/qr_code_scan_title"
app:titleTextColor="@color/colorQrCodeScanToolbar">

<ToggleButton
android:id="@+id/submission_qr_code_scan_torch"
android:layout_width="@dimen/icon_size_button"
android:layout_height="@dimen/icon_size_button"
android:layout_gravity="end"
android:layout_marginEnd="@dimen/spacing_tiny"
android:background="@drawable/ic_registration_qr_code_scan_torch_toggle"
android:backgroundTint="@color/colorStableLight"
android:backgroundTint="@color/colorQrCodeScanToolbar"
android:textOff=""
android:textOn=""
app:layout_constraintBottom_toTopOf="@+id/submission_qr_code_scan_guideline_top"
app:layout_constraintEnd_toStartOf="@+id/guideline_end"
app:layout_constraintStart_toStartOf="@+id/guideline_end"
app:layout_constraintTop_toTopOf="@+id/submission_qr_code_scan_guideline_top" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/submission_qr_code_scan_guideline_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="@dimen/spacing_normal" />
android:textOn="" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/submission_qr_code_scan_guideline_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
</com.google.android.material.appbar.MaterialToolbar>

<include layout="@layout/merge_guidelines_side" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/submission_qr_code_scan_guideline_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions Corona-Warn-App/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,9 @@
<string name="submission_qr_code_scan_invalid_dialog_button_negative">"Abbrechen"</string>

<!-- QR Code Scan Screen -->
<string name="submission_qr_code_scan_title">"Positionieren Sie den QR-Code in den Rahmen."</string>
<string name="qr_code_scan_title">"QR-Code Scan"</string>
<!-- YTXT: instruction text for QR code scanning -->
<string name="submission_qr_code_scan_body">"Positionieren Sie den QR-Code in den Rahmen."</string>
<string name="qr_code_scan_body">"Positionieren Sie den QR-Code in den Rahmen."</string>

<!-- QR Code Consent Screen -->
<!-- XHED: Page headline for Submission consent -->
Expand Down
3 changes: 3 additions & 0 deletions Corona-Warn-App/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@
<color name="colorTraceLocationIconDateBackground">#434445</color>
<color name="colorTraceLocationGradientBackground">#000000</color>

<!-- QR Code Scan -->
<color name="colorQrCodeScanToolbar">#FFFFFF</color>
<color name="colorQrCodeScanMask">#BF000000</color>
</resources>
4 changes: 4 additions & 0 deletions Corona-Warn-App/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<color name="colorTraceLocationButtonTextColor">#F5F5F5</color>


<!-- QR Code Scan -->
<color name="colorQrCodeScanToolbar">#000000</color>
<color name="colorQrCodeScanMask">#BFFFFFFF</color>

<!-- Swipe to delete background color -->
<color name="swipeDeleteBackgroundColor">#EB4D3D</color>
</resources>
6 changes: 3 additions & 3 deletions Corona-Warn-App/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
<dimen name="submission_tan_total_digit_spacing">6dp</dimen>
<dimen name="submission_tan_total_group_spacing">16dp</dimen>

<!-- Submission QR Code Scan -->
<dimen name="submission_scan_qr_code_viewfinder_size">240dp</dimen>
<dimen name="submission_scan_qr_code_viewfinder_center_offset">120dp</dimen>
<!-- QR Code Scan -->
<dimen name="scan_qr_code_viewfinder_size">300dp</dimen>
<dimen name="scan_qr_code_viewfinder_center_offset">150dp</dimen>

<!-- Submission Country Select -->
<dimen name="submission_country_selection_country_icon_size">40dp</dimen>
Expand Down
Loading

0 comments on commit d8d2f5f

Please sign in to comment.