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 5c5fe1ffbcc6f52e917cd22872a582d4f4f735a8..2942c09bfbadaa8fa99e019895309cc7fb472e5a 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 @@ -329,35 +329,6 @@ fun formatNextUpdate( } } -/** - * Formats the risk card content description of time when diagnosis keys will be updated - * from server again when applicable but appends the word button at the end for screen reader accessibility reasons - * - * @param riskLevelScore - * @param isBackgroundJobEnabled - * @return - */ -fun formatNextUpdateContentDescription( - riskLevelScore: Int?, - isBackgroundJobEnabled: Boolean? -): String { - val appContext = CoronaWarnApplication.getAppContext() - return if (isBackgroundJobEnabled != true) { - "" - } else { - return when (riskLevelScore) { - RiskLevelConstants.UNKNOWN_RISK_INITIAL, - RiskLevelConstants.LOW_LEVEL_RISK, - RiskLevelConstants.INCREASED_RISK -> appContext.getString( - R.string.risk_card_body_next_update - ) + " " + appContext.getString( - R.string.accessibility_button - ) - else -> "" - } - } -} - /** * Formats the risk details text display for each risk level * diff --git a/Corona-Warn-App/src/main/res/layout/include_risk_card.xml b/Corona-Warn-App/src/main/res/layout/include_risk_card.xml index 48b1e91d6db96e6eca06ea1431e5e71c6af70792..9c50cbc7028d3ad1b509b4c0f603f4fdc9864e5f 100644 --- a/Corona-Warn-App/src/main/res/layout/include_risk_card.xml +++ b/Corona-Warn-App/src/main/res/layout/include_risk_card.xml @@ -227,7 +227,6 @@ android:layout_width="@dimen/match_constraint" android:layout_height="wrap_content" android:layout_marginTop="@dimen/spacing_small" - android:contentDescription="@{FormatterRiskHelper.formatNextUpdateContentDescription(tracingViewModel.riskLevel, settingsViewModel.isBackgroundJobEnabled())}" android:text="@{FormatterRiskHelper.formatNextUpdate(tracingViewModel.riskLevel, settingsViewModel.isBackgroundJobEnabled())}" android:textColor="@{FormatterRiskHelper.formatStableTextColor(tracingViewModel.riskLevel)}" app:layout_constraintEnd_toEndOf="parent" diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelperTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelperTest.kt index 3240d2c3eb558619c041d5bc88799dde19f4b6b9..2eea80e2d9b6964bdc5b772732a4e36702805630 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelperTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterRiskHelperTest.kt @@ -173,24 +173,6 @@ class FormatterRiskHelperTest { ) } - private fun formatNextUpdateContentDescriptionBase( - iRiskLevelScore: Int?, - bIsBackgroundJobEnabled: Boolean?, - sValue: String - ) { - every { context.getString(R.string.risk_card_body_next_update) } returns R.string.risk_card_body_next_update.toString() - every { context.getString(R.string.accessibility_button) } returns R.string.accessibility_button.toString() - - val result = - formatNextUpdateContentDescription( - riskLevelScore = iRiskLevelScore, - isBackgroundJobEnabled = bIsBackgroundJobEnabled - ) - assertThat( - result, `is`(sValue) - ) - } - private fun formatRiskDetailsRiskLevelBodyBase( iRiskLevelScore: Int?, iDaysSinceLastExposure: Int?, @@ -980,79 +962,6 @@ class FormatterRiskHelperTest { ) } - @Test - fun formatNextUpdateContentDescription() { - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = null, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.INCREASED_RISK, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.UNKNOWN_RISK_OUTDATED_RESULTS, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.NO_CALCULATION_POSSIBLE_TRACING_OFF, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.LOW_LEVEL_RISK, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.UNKNOWN_RISK_INITIAL, - bIsBackgroundJobEnabled = null, - sValue = "" - ) - - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = null, - bIsBackgroundJobEnabled = true, - sValue = "" - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.INCREASED_RISK, - bIsBackgroundJobEnabled = true, - sValue = context.getString( - R.string.risk_card_body_next_update - ) + " " + context.getString( - R.string.accessibility_button - ) - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.UNKNOWN_RISK_OUTDATED_RESULTS, - bIsBackgroundJobEnabled = true, - sValue = "" - ) - - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.LOW_LEVEL_RISK, - bIsBackgroundJobEnabled = true, - sValue = context.getString( - R.string.risk_card_body_next_update - ) + " " + context.getString( - R.string.accessibility_button - ) - ) - formatNextUpdateContentDescriptionBase( - iRiskLevelScore = RiskLevelConstants.UNKNOWN_RISK_INITIAL, - bIsBackgroundJobEnabled = true, - sValue = context.getString( - R.string.risk_card_body_next_update - ) + " " + context.getString( - R.string.accessibility_button - ) - ) - } - @Test fun formatRiskDetailsRiskLevelBody() { formatRiskDetailsRiskLevelBodyBase(