From ef9ed48550aa8e16bf0f936645cad7038484b52e Mon Sep 17 00:00:00 2001 From: Oliver Zimmerman <oezimmerman@gmail.com> Date: Thu, 10 Sep 2020 08:19:05 +0100 Subject: [PATCH] Removed 'Button' announcement on risk card (EXPOSUREAPP-1542) (#945) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * removed button announcement entirely * removed assosciated test * removed unneccesarry tests Co-authored-by: Jakob Möller <jakob.moeller@sap.com> Co-authored-by: harambasicluka <64483219+harambasicluka@users.noreply.github.com> --- .../util/formatter/FormatterRiskHelper.kt | 29 ------ .../src/main/res/layout/include_risk_card.xml | 1 - .../util/formatter/FormatterRiskHelperTest.kt | 91 ------------------- 3 files changed, 121 deletions(-) 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 5c5fe1ffb..2942c09bf 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 48b1e91d6..9c50cbc70 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 3240d2c3e..2eea80e2d 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( -- GitLab