From 2e145dafab5b999e0f9586f00e882cfda44d2ef3 Mon Sep 17 00:00:00 2001
From: Rituraj Sambherao <git.rituraj.sambherao@gmail.com>
Date: Tue, 14 Jul 2020 19:37:43 +0100
Subject: [PATCH] ui adjustment and pipeline fixes

---
 .../util/formatter/FormatterRiskHelper.kt     | 13 ++--
 .../main/res/layout/fragment_risk_details.xml |  4 +-
 .../res/layout/fragment_settings_tracing.xml  |  2 +-
 ...nclude_risk_details_period_logged_card.xml |  3 +-
 ...de_risk_details_period_logged_progress.xml | 75 +++++++------------
 .../include_setting_tracing_period_logged.xml | 62 +++++++++++++++
 6 files changed, 102 insertions(+), 57 deletions(-)
 create mode 100644 Corona-Warn-App/src/main/res/layout/include_setting_tracing_period_logged.xml

diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt
index ea3495421..a89f5f639 100644
--- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt
+++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelper.kt
@@ -225,12 +225,13 @@ fun formatRiskActiveTracingDaysInRetentionPeriodLogged(
     activeTracingDaysInRetentionPeriod: Long
 ): String {
     val appContext = CoronaWarnApplication.getAppContext()
-    var periodLoggedString :String =""
-      if (riskLevelScore == RiskLevelConstants.LOW_LEVEL_RISK || riskLevelScore == RiskLevelConstants.INCREASED_RISK) {
-          periodLoggedString = appContext.getString(
-              R.string.risk_details_information_body_period_logged_assessment
-          ).format(activeTracingDaysInRetentionPeriod)
-      }
+    var periodLoggedString = ""
+        if (riskLevelScore == RiskLevelConstants.LOW_LEVEL_RISK ||
+            riskLevelScore == RiskLevelConstants.INCREASED_RISK) {
+            periodLoggedString = appContext.getString(
+                R.string.risk_details_information_body_period_logged_assessment
+            ).format(activeTracingDaysInRetentionPeriod)
+        }
     return periodLoggedString
 }
 
diff --git a/Corona-Warn-App/src/main/res/layout/fragment_risk_details.xml b/Corona-Warn-App/src/main/res/layout/fragment_risk_details.xml
index 89674ce6a..c7704aa98 100644
--- a/Corona-Warn-App/src/main/res/layout/fragment_risk_details.xml
+++ b/Corona-Warn-App/src/main/res/layout/fragment_risk_details.xml
@@ -181,7 +181,7 @@
                 </androidx.constraintlayout.widget.ConstraintLayout>
 
                 <include
-                    android:id="@+id/risk_details_behavior_increased_risk_3"
+                    android:id="@+id/risk_details_period_logged_card"
                     layout="@layout/include_risk_details_period_logged_card"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
@@ -200,7 +200,7 @@
                     android:layout_height="wrap_content"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="parent">
+                    app:layout_constraintTop_toBottomOf="@id/risk_details_period_logged_card">
 
                     <TextView
                         android:id="@+id/risk_details_information_headline"
diff --git a/Corona-Warn-App/src/main/res/layout/fragment_settings_tracing.xml b/Corona-Warn-App/src/main/res/layout/fragment_settings_tracing.xml
index 61493b1d7..4bd2c7699 100644
--- a/Corona-Warn-App/src/main/res/layout/fragment_settings_tracing.xml
+++ b/Corona-Warn-App/src/main/res/layout/fragment_settings_tracing.xml
@@ -115,7 +115,7 @@
 
                     <include
                         android:id="@+id/settings_tracing_status_tracing"
-                        layout="@layout/include_risk_details_period_logged_progress"
+                        layout="@layout/include_setting_tracing_period_logged"
                         android:layout_width="0dp"
                         android:layout_height="wrap_content"
                         android:focusable="true"
diff --git a/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_card.xml b/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_card.xml
index 8708442d1..06b18535d 100644
--- a/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_card.xml
+++ b/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_card.xml
@@ -19,7 +19,6 @@
         android:layout_height="match_parent"
         android:focusable="true">
 
-
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/risk_details_period_logged_layout"
             android:layout_width="match_parent"
@@ -65,13 +64,13 @@
                 app:layout_constraintEnd_toEndOf="parent"
                 app:layout_constraintStart_toStartOf="parent"
                 app:layout_constraintTop_toBottomOf="@id/risk_details_period_logged_subtitle" />
-
         </androidx.constraintlayout.widget.ConstraintLayout>
 
         <include
             android:id="@+id/risk_details_period_logged_progress"
             layout="@layout/include_risk_details_period_logged_progress"
             android:layout_width="0dp"
+            android:layout_marginTop="@dimen/spacing_normal"
             android:layout_height="wrap_content"
             android:focusable="true"
             app:layout_constraintEnd_toEndOf="parent"
diff --git a/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_progress.xml b/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_progress.xml
index 5f84e87a4..1fac8333c 100644
--- a/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_progress.xml
+++ b/Corona-Warn-App/src/main/res/layout/include_risk_details_period_logged_progress.xml
@@ -18,56 +18,39 @@
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-        <TextView
-            android:id="@+id/risk_details_period_logged_body_notice"
-            style="@style/body1"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/spacing_normal"
-            android:focusable="true"
-            android:text="@string/risk_details_information_body_period_logged"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/spacing_normal"
+        android:focusable="true"
+        app:layout_constraintTop_toTopOf="parent">
 
         <androidx.constraintlayout.widget.ConstraintLayout
-            android:layout_width="match_parent"
+            android:id="@+id/risk_details_behavior_icon"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:focusable="true"
-            android:layout_marginTop="@dimen/spacing_normal"
-            app:layout_constraintTop_toBottomOf="@id/risk_details_period_logged_body_notice">
-
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:id="@+id/risk_details_behavior_icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent">
-
-                <de.rki.coronawarnapp.ui.view.CircleProgress
-                    android:id="@+id/risk_details_investigation_period_circle_progress"
-                    android:layout_width="@dimen/spacing_huge"
-                    android:layout_height="@dimen/spacing_huge"
-                    android:importantForAccessibility="no"
-                    app:circleWidth="@dimen/circle_large_width"
-                    app:layout_constraintEnd_toEndOf="parent"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:progress="@{tracingViewModel.activeTracingDaysInRetentionPeriod}" />
-            </androidx.constraintlayout.widget.ConstraintLayout>
-
-            <TextView
-                style="@style/subtitle"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="@dimen/spacing_small"
-                android:text="@{FormatterRiskHelper.formatRiskActiveTracingDaysInRetentionPeriodLogged(tracingViewModel.riskLevel, tracingViewModel.activeTracingDaysInRetentionPeriod)}"
-                app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <de.rki.coronawarnapp.ui.view.CircleProgress
+                android:id="@+id/risk_details_investigation_period_circle_progress"
+                android:layout_width="@dimen/spacing_huge"
+                android:layout_height="@dimen/spacing_huge"
+                android:importantForAccessibility="no"
+                app:circleWidth="@dimen/circle_large_width"
                 app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintStart_toEndOf="@+id/risk_details_behavior_icon"
-                app:layout_constraintTop_toTopOf="parent" />
+                app:layout_constraintTop_toTopOf="parent"
+                app:progress="@{tracingViewModel.activeTracingDaysInRetentionPeriod}" />
         </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <TextView
+            style="@style/subtitle"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/spacing_small"
+            android:text="@{FormatterRiskHelper.formatRiskActiveTracingDaysInRetentionPeriodLogged(tracingViewModel.riskLevel, tracingViewModel.activeTracingDaysInRetentionPeriod)}"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/risk_details_behavior_icon"
+            app:layout_constraintTop_toTopOf="parent" />
     </androidx.constraintlayout.widget.ConstraintLayout>
 </layout>
\ No newline at end of file
diff --git a/Corona-Warn-App/src/main/res/layout/include_setting_tracing_period_logged.xml b/Corona-Warn-App/src/main/res/layout/include_setting_tracing_period_logged.xml
new file mode 100644
index 000000000..d83e827f5
--- /dev/null
+++ b/Corona-Warn-App/src/main/res/layout/include_setting_tracing_period_logged.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:tools="http://schemas.android.com/tools"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <data>
+
+        <import type="de.rki.coronawarnapp.util.formatter.FormatterHelper" />
+
+        <import type="de.rki.coronawarnapp.util.formatter.FormatterRiskHelper" />
+
+        <variable
+            name="riskLevel"
+            type="Integer" />
+
+        <variable
+            name="tracingViewModel"
+            type="de.rki.coronawarnapp.ui.viewmodel.TracingViewModel" />
+
+    </data>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:focusable="true">
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/risk_details_period_logged_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/spacing_tiny"
+            android:focusable="true"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <TextView
+                android:id="@+id/risk_details_period_logged_body_notice"
+                style="@style/subtitleMedium"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:focusable="true"
+                android:text="@string/risk_details_information_body_period_logged"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <include
+            android:id="@+id/risk_details_behavior_stay_home"
+            layout="@layout/include_risk_details_period_logged_progress"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/spacing_normal"
+            android:focusable="false"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/risk_details_period_logged_layout"
+            app:riskLevel="@{tracingViewModel.riskLevel}"
+            app:tracingViewModel="@{tracingViewModel}" />
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</layout>
\ No newline at end of file
-- 
GitLab