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

Commit

Permalink
Encounter with low risk missing link in risk details (EXPOSUREAPP-288…
Browse files Browse the repository at this point in the history
…3) (#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 917fdc5.

* 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 <[email protected]>
  • Loading branch information
BMItr and mertsafter authored Sep 28, 2020
1 parent e57be55 commit 54eb836
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ 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
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.
Expand Down Expand Up @@ -47,6 +49,7 @@ class RiskDetailsFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setButtonOnClickListeners()
setUpWebLinks()
}

override fun onResume() {
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion Corona-Warn-App/src/main/res/layout/fragment_risk_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,28 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/risk_details_information_body" />

<TextView
android:id="@+id/risk_details_information_lowrisk_body_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:text="@string/risk_details_explanation_faq_body_with_link"
android:visibility="@{FormatterRiskHelper.formatVisibilityBehaviorLowLevelRisk(tracingViewModel.riskLevel)}"
android:focusable="true"
android:clickable="true"
android:linksClickable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/risk_details_information_body_notice" />

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="@dimen/guideline_start" />
app:layout_constraintGuide_begin="@dimen/guideline_top" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_end"
Expand Down
2 changes: 2 additions & 0 deletions Corona-Warn-App/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@
<string name="risk_details_explanation_dialog_title">"Information zur Funktionsweise der Risiko-Ermittlung"</string>
<!-- YTXT: one time risk explanation dialog - pointing to the faq page for more information-->
<string name="risk_details_explanation_dialog_faq_body">"Weitere Informationen finden Sie in den FAQ."</string>
<!-- XLNK: risk explanations and informations - pointing to the faq page for more information and contains hyperlink-->
<string name="risk_details_explanation_faq_body_with_link"><a href="https://www.coronawarn.app/de/faq/#encounter_but_green">Weitere Informationen finden Sie in den FAQ.</a></string>

<!-- ####################################
Onboarding
Expand Down
3 changes: 2 additions & 1 deletion Corona-Warn-App/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@
<string name="risk_details_explanation_dialog_title">"Information about exposure logging functionality"</string>
<!-- YTXT: one time risk explanation dialog - pointing to the faq page for more information-->
<string name="risk_details_explanation_dialog_faq_body">"For further information, please see our FAQ page."</string>

<!-- XLNK: risk explanations and informations - pointing to the faq page for more information and contains hyperlink-->
<string name="risk_details_explanation_faq_body_with_link"><a href="https://www.coronawarn.app/en/faq/#encounter_but_green">For further information, please see our FAQ page.</a>"</string>
<!-- ####################################
Onboarding
###################################### -->
Expand Down

0 comments on commit 54eb836

Please sign in to comment.