From fb2602fc8fe03f9035c7095fda6bb295a8a21691 Mon Sep 17 00:00:00 2001 From: chris-cwa <69595386+chris-cwa@users.noreply.github.com> Date: Thu, 27 May 2021 22:54:36 +0200 Subject: [PATCH] Hint to Find details in journal (EXPOSUREAPP-5829) (#3291) * Additional hint to find details of exposures in the contact journal * removed unnecessary var * add box to adapter * removed unessesary view group Co-authored-by: harambasicluka <64483219+harambasicluka@users.noreply.github.com> Co-authored-by: Mohamed Metwalli <mohamed.metwalli@sap.com> --- .../ui/details/TracingDetailsAdapter.kt | 2 ++ .../ui/details/TracingDetailsItemProvider.kt | 11 +++++-- .../FindDetailsInJournalBox.kt | 31 +++++++++++++++++++ ...racing_details_find_details_in_journal.xml | 14 +++++++++ .../src/main/res/values-de/strings.xml | 2 ++ .../src/main/res/values/strings.xml | 2 ++ 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/items/additionalinfos/FindDetailsInJournalBox.kt create mode 100644 Corona-Warn-App/src/main/res/layout/tracing_details_find_details_in_journal.xml diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsAdapter.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsAdapter.kt index 18c071543..9749b21aa 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsAdapter.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsAdapter.kt @@ -5,6 +5,7 @@ import androidx.annotation.LayoutRes import androidx.viewbinding.ViewBinding import de.rki.coronawarnapp.tracing.ui.details.items.DetailsItem import de.rki.coronawarnapp.tracing.ui.details.items.additionalinfos.AdditionalInfoLowRiskBox +import de.rki.coronawarnapp.tracing.ui.details.items.additionalinfos.FindDetailsInJournalBox import de.rki.coronawarnapp.tracing.ui.details.items.behavior.BehaviorIncreasedRiskBox import de.rki.coronawarnapp.tracing.ui.details.items.behavior.BehaviorNormalRiskBox import de.rki.coronawarnapp.tracing.ui.details.items.periodlogged.PeriodLoggedBox @@ -49,6 +50,7 @@ class TracingDetailsAdapter( TypedVHCreatorMod({ data[it] is BehaviorIncreasedRiskBox.Item }) { BehaviorIncreasedRiskBox(it) }, TypedVHCreatorMod({ data[it] is BehaviorNormalRiskBox.Item }) { BehaviorNormalRiskBox(it) }, TypedVHCreatorMod({ data[it] is AdditionalInfoLowRiskBox.Item }) { AdditionalInfoLowRiskBox(it) }, + TypedVHCreatorMod({ data[it] is FindDetailsInJournalBox.Item }) { FindDetailsInJournalBox(it) }, TypedVHCreatorMod({ data[it] is UserSurveyBox.Item }) { UserSurveyBox( parent = it, diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsItemProvider.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsItemProvider.kt index 7537905dc..3f524d03b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsItemProvider.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/TracingDetailsItemProvider.kt @@ -9,6 +9,7 @@ import de.rki.coronawarnapp.tracing.GeneralTracingStatus import de.rki.coronawarnapp.tracing.GeneralTracingStatus.Status import de.rki.coronawarnapp.tracing.ui.details.items.DetailsItem import de.rki.coronawarnapp.tracing.ui.details.items.additionalinfos.AdditionalInfoLowRiskBox +import de.rki.coronawarnapp.tracing.ui.details.items.additionalinfos.FindDetailsInJournalBox import de.rki.coronawarnapp.tracing.ui.details.items.behavior.BehaviorIncreasedRiskBox import de.rki.coronawarnapp.tracing.ui.details.items.behavior.BehaviorNormalRiskBox import de.rki.coronawarnapp.tracing.ui.details.items.periodlogged.PeriodLoggedBox @@ -44,11 +45,17 @@ class TracingDetailsItemProvider @Inject constructor( val latestCalc = riskLevelResults.lastCalculated + val lowRiskWithEncounters = latestCalc.riskState == RiskState.LOW_RISK && + latestCalc.matchedRiskCount > 0 + mutableListOf<DetailsItem>().apply { if (status != Status.TRACING_INACTIVE && - latestCalc.riskState == RiskState.LOW_RISK && - latestCalc.matchedRiskCount > 0 + (lowRiskWithEncounters || latestCalc.riskState == RiskState.INCREASED_RISK) ) { + add(FindDetailsInJournalBox.Item) + } + + if (status != Status.TRACING_INACTIVE && lowRiskWithEncounters) { add(AdditionalInfoLowRiskBox.Item) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/items/additionalinfos/FindDetailsInJournalBox.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/items/additionalinfos/FindDetailsInJournalBox.kt new file mode 100644 index 000000000..48cf2f853 --- /dev/null +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/ui/details/items/additionalinfos/FindDetailsInJournalBox.kt @@ -0,0 +1,31 @@ +package de.rki.coronawarnapp.tracing.ui.details.items.additionalinfos + +import android.view.ViewGroup +import androidx.annotation.LayoutRes +import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.databinding.TracingDetailsFindDetailsInJournalBinding +import de.rki.coronawarnapp.tracing.ui.details.TracingDetailsAdapter + +class FindDetailsInJournalBox( + parent: ViewGroup, + @LayoutRes containerLayout: Int = R.layout.tracing_details_find_details_in_journal +) : TracingDetailsAdapter.DetailsItemVH<FindDetailsInJournalBox.Item, TracingDetailsFindDetailsInJournalBinding>( + containerLayout, + parent +) { + + override val viewBinding = lazy { + TracingDetailsFindDetailsInJournalBinding.inflate( + layoutInflater, + itemView.findViewById(R.id.box_container), + true + ) + } + + override val onBindData: TracingDetailsFindDetailsInJournalBinding.( + item: Item, + payloads: List<Any> + ) -> Unit = { _, _ -> } + + object Item : AdditionalInformationItem +} diff --git a/Corona-Warn-App/src/main/res/layout/tracing_details_find_details_in_journal.xml b/Corona-Warn-App/src/main/res/layout/tracing_details_find_details_in_journal.xml new file mode 100644 index 000000000..943d16269 --- /dev/null +++ b/Corona-Warn-App/src/main/res/layout/tracing_details_find_details_in_journal.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/risk_details_find_details_in_journal" + style="@style/body1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginHorizontal="@dimen/spacing_normal" + android:layout_marginTop="@dimen/spacing_normal" + android:focusable="true" + android:text="@string/risk_details_find_details_in_journal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> \ 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 69f808d82..2d56b6304 100644 --- a/Corona-Warn-App/src/main/res/values-de/strings.xml +++ b/Corona-Warn-App/src/main/res/values-de/strings.xml @@ -282,6 +282,8 @@ <string name="risk_details_behavior_body_wear_mask">"Tragen Sie einen Mund-Nasen-Schutz bei Begegnungen mit anderen Personen."</string> <!-- XMSG: risk details - stay 1,5 away, something like a bullet point --> <string name="risk_details_behavior_body_stay_away">"Halten Sie mindestens 1,5 Meter Abstand zu anderen Personen."</string> + <!-- XTXT: find details about exposures in the contact journal --> + <string name="risk_details_find_details_in_journal">Weitere Informationen zu Ihren Risiko-Begegnungen finden Sie in Ihrem Kontakt-Tagebuch.</string> <!-- XMSG: risk details - link to faq, something like a bullet point --> <string name="risk_details_increased_risk_faq_link_text">"Falls Sie sich testen lassen, finden Sie weitere Informationen in der FAQ zum Testablauf."</string> diff --git a/Corona-Warn-App/src/main/res/values/strings.xml b/Corona-Warn-App/src/main/res/values/strings.xml index 9e6f2ee6f..cfb76b271 100644 --- a/Corona-Warn-App/src/main/res/values/strings.xml +++ b/Corona-Warn-App/src/main/res/values/strings.xml @@ -282,6 +282,8 @@ <string name="risk_details_behavior_body_wear_mask">"Wear a face mask when you encounter other people."</string> <!-- XMSG: risk details - stay 1,5 away, something like a bullet point --> <string name="risk_details_behavior_body_stay_away">"Keep at least 1.5 meters distance from other people."</string> + <!-- XTXT: find details about exposures in the contact journal --> + <string name="risk_details_find_details_in_journal"></string> <!-- XMSG: risk details - link to faq, something like a bullet point --> <string name="risk_details_increased_risk_faq_link_text">"If you get tested, you will find additional information about the testing procedure in the FAQ."</string> -- GitLab