From 6c146c3a66ff6a09be14e0124f7245b947fe13cb Mon Sep 17 00:00:00 2001 From: Lukas Lechner Date: Thu, 11 Feb 2021 11:41:17 +0100 Subject: [PATCH 1/2] Show active tracing history in low risk detail screen --- .../main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt | 5 +++++ .../src/main/res/layout/tracing_content_low_view.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt index 285a6d9a168..e3f6c895cfc 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt @@ -4,6 +4,11 @@ import android.view.View import androidx.databinding.BindingAdapter import de.rki.coronawarnapp.util.recyclerview.ThrottledClickListener +@BindingAdapter("visible") +fun View.setVisible(visible: Boolean) { + visibility = if (visible) View.VISIBLE else View.GONE +} + @BindingAdapter("gone") fun View.setGone(gone: Boolean) { visibility = if (gone) View.GONE else View.VISIBLE diff --git a/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml b/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml index 335b19a32b8..53b2efbe203 100644 --- a/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml +++ b/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml @@ -74,7 +74,7 @@ Date: Fri, 12 Feb 2021 10:46:34 +0100 Subject: [PATCH 2/2] Move isGone logic from xml layout into state object and add tests --- .../tracing/states/TracingState.kt | 2 + .../coronawarnapp/util/ui/ViewExtensions.kt | 5 -- .../res/layout/tracing_content_low_view.xml | 2 +- .../tracing/states/LowRiskTest.kt | 71 +++++++++++++++++++ 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 Corona-Warn-App/src/test/java/de/rki/coronawarnapp/tracing/states/LowRiskTest.kt diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/states/TracingState.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/states/TracingState.kt index f36759a4c8e..a34123bfa1c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/states/TracingState.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/tracing/states/TracingState.kt @@ -168,6 +168,8 @@ data class LowRisk( ) } + fun isGoneOnContentLowView(context: Context) = getRiskContactLast(context) != null && !isInDetailsMode + fun getProgressColorLowRisk(context: Context) = context.getColorCompat(R.color.colorStableLight) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt index e3f6c895cfc..285a6d9a168 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ui/ViewExtensions.kt @@ -4,11 +4,6 @@ import android.view.View import androidx.databinding.BindingAdapter import de.rki.coronawarnapp.util.recyclerview.ThrottledClickListener -@BindingAdapter("visible") -fun View.setVisible(visible: Boolean) { - visibility = if (visible) View.VISIBLE else View.GONE -} - @BindingAdapter("gone") fun View.setGone(gone: Boolean) { visibility = if (gone) View.GONE else View.VISIBLE diff --git a/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml b/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml index 53b2efbe203..dd85e6ef0a3 100644 --- a/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml +++ b/Corona-Warn-App/src/main/res/layout/tracing_content_low_view.xml @@ -74,7 +74,7 @@