From 54eb836348f8842d0831b1dd84cb78e9009937ee Mon Sep 17 00:00:00 2001 From: BMItter <46747780+BMItter@users.noreply.github.com> Date: Mon, 28 Sep 2020 12:44:03 +0200 Subject: [PATCH] Encounter with low risk missing link in risk details (EXPOSUREAPP-2883) (#1243) * updated risk details information body with new text and link (please check twice the text) * Revert "updated risk details information body with new text and link (please check twice the text)" This reverts commit 917fdc5715eeb9334dd98be24f522b185adf1cdd. * missing link fixed for low exposure state risk details (draft) * fixed link * testable version for fixed link (on low exposure state) * Fix not clickable link (#2883) * fixed herlink convert input reference * provide default link for encounter but green * removed testcode for checking low risk exposure state Co-authored-by: Mert Safter --- .../ui/riskdetails/RiskDetailsFragment.kt | 11 +++++++++++ .../util/formatter/FormatterRiskHelper.kt | 10 ++++++++++ .../main/res/layout/fragment_risk_details.xml | 16 +++++++++++++++- .../src/main/res/values-de/strings.xml | 2 ++ Corona-Warn-App/src/main/res/values/strings.xml | 3 ++- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt index db5bba73860..65ec3575343 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt @@ -8,6 +8,7 @@ import android.view.accessibility.AccessibilityEvent import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentRiskDetailsBinding import de.rki.coronawarnapp.timer.TimerHelper import de.rki.coronawarnapp.ui.doNavigate @@ -15,6 +16,7 @@ import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.viewLifecycle import de.rki.coronawarnapp.ui.viewmodel.SettingsViewModel import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel +import de.rki.coronawarnapp.util.convertToHyperlink /** * This is the detail view of the risk card if additional information for the user. @@ -47,6 +49,7 @@ class RiskDetailsFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) setButtonOnClickListeners() + setUpWebLinks() } override fun onResume() { @@ -60,6 +63,14 @@ class RiskDetailsFragment : Fragment() { binding.riskDetailsContainer.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT) } + /** + * Make the links clickable and convert to hyperlink + */ + private fun setUpWebLinks() { + binding.riskDetailsInformationLowriskBodyUrl + .convertToHyperlink(getString(R.string.risk_details_explanation_faq_body_with_link)) + } + private fun setButtonOnClickListeners() { binding.riskDetailsHeaderButtonBack.setOnClickListener { (activity as MainActivity).goBack() 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 4c06814bafe..bf158e8962f 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 @@ -583,6 +583,16 @@ fun formatVisibilityBehavior(riskLevelScore: Int?): Int = fun formatVisibilityBehaviorIncreasedRisk(riskLevelScore: Int?): Int = formatVisibility(riskLevelScore == RiskLevelConstants.INCREASED_RISK) +/** + * Format the risk details include display for suggested behavior depending on risk level + * Only applied in special case for low level risk + * + * @param riskLevelScore + * @return + */ +fun formatVisibilityBehaviorLowLevelRisk(riskLevelScore: Int?): Int = + formatVisibility(riskLevelScore == RiskLevelConstants.LOW_LEVEL_RISK) + /** * Format the risk details period logged card display depending on risk level * applied in case of low and high risk levels 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 e538e5b2b0e..a28df352887 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 @@ -264,6 +264,20 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/risk_details_information_body" /> + + + app:layout_constraintGuide_begin="@dimen/guideline_top" /> "Information zur Funktionsweise der Risiko-Ermittlung" "Weitere Informationen finden Sie in den FAQ." + + Weitere Informationen finden Sie in den FAQ. "For further information, please see our FAQ page." - + + For further information, please see our FAQ page."