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

Improve talkback in statistics (EXPOSUREAPP-8653) #5894

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import de.rki.coronawarnapp.statistics.ui.homecards.StatisticsCardAdapter
import de.rki.coronawarnapp.statistics.util.formatStatisticalValue
import de.rki.coronawarnapp.statistics.util.getContentDescriptionForTrends
import de.rki.coronawarnapp.statistics.util.getLocalizedSpannableString
import de.rki.coronawarnapp.util.StringBuilderExtension.appendWithLineBreak
import de.rki.coronawarnapp.util.StringBuilderExtension.appendWithTrailingSpace
import de.rki.coronawarnapp.util.formatter.getPrimaryLabel
import de.rki.coronawarnapp.util.formatter.getSecondaryLabel
Expand Down Expand Up @@ -98,8 +97,8 @@ class IncidenceAndHospitalizationCard(parent: ViewGroup) :
): StringBuilder {
return StringBuilder()
.appendWithTrailingSpace(context.getString(R.string.accessibility_statistics_card_announcement))
.appendWithLineBreak(context.getString(R.string.statistics_explanation_seven_day_incidence_title))
.appendWithLineBreak(context.getString(R.string.statistics_seven_day_hospitalization_nationwide_text))
.appendWithTrailingSpace(context.getString(R.string.statistics_explanation_seven_day_incidence_title))
.appendWithTrailingSpace(context.getString(R.string.statistics_seven_day_hospitalization_nationwide_text))
.appendWithTrailingSpace(item.getPrimaryLabel(context))
.appendWithTrailingSpace(
formatStatisticalValue(
Expand All @@ -109,8 +108,8 @@ class IncidenceAndHospitalizationCard(parent: ViewGroup) :
)
)
.appendWithTrailingSpace(context.getString(R.string.statistics_card_incidence_value_description))
.appendWithLineBreak(getContentDescriptionForTrends(context, sevenDayIncidence.trend))
.appendWithLineBreak(context.getString(R.string.statistics_seven_day_hospitalization_card_title))
.appendWithTrailingSpace(getContentDescriptionForTrends(context, sevenDayIncidence.trend))
.appendWithTrailingSpace(context.getString(R.string.statistics_seven_day_hospitalization_card_title))
.appendWithTrailingSpace(
getSecondaryLabel(context, Instant.ofEpochSecond(sevenDayIncidenceSecondary.updatedAt))
)
Expand All @@ -121,7 +120,7 @@ class IncidenceAndHospitalizationCard(parent: ViewGroup) :
sevenDayIncidenceSecondary.decimals
)
)
.appendWithLineBreak(getContentDescriptionForTrends(context, sevenDayIncidenceSecondary.trend))
.append(context.getString(R.string.accessibility_statistics_card_navigation_information))
.appendWithTrailingSpace(getContentDescriptionForTrends(context, sevenDayIncidenceSecondary.trend))
.appendWithTrailingSpace(context.getString(R.string.accessibility_statistics_card_navigation_information))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.core.view.isGone
import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.databinding.HomeStatisticsCardsLinkCardLayoutBinding
import de.rki.coronawarnapp.statistics.ui.homecards.StatisticsCardAdapter
import de.rki.coronawarnapp.util.StringBuilderExtension.appendWithTrailingSpace

class LinkViewCard(parent: ViewGroup) :
StatisticsCardAdapter.ItemVH<LinkCardItem, HomeStatisticsCardsLinkCardLayoutBinding>(
Expand All @@ -30,8 +31,15 @@ class LinkViewCard(parent: ViewGroup) :
} else {
itemView.layoutParams.width = context.resources.getDimensionPixelSize(R.dimen.width_300)
}
cardLinkContainer.contentDescription = buildAccessibilityString()
infoStatistics.isGone = curItem.isEol
infoStatistics.setOnClickListener { curItem.onClickListener(curItem.linkStats) }
linkButton.setOnClickListener { curItem.openLink(curItem.linkStats.url) }
}

private fun buildAccessibilityString() = StringBuilder()
.appendWithTrailingSpace(context.getString(R.string.pandemic_radar_card_title))
.appendWithTrailingSpace(context.getString(R.string.pandemic_radar_card_subtitle))
.appendWithTrailingSpace(context.getString(R.string.pandemic_radar_card_message))
.appendWithTrailingSpace(context.getString(R.string.pandemic_Radar_card_button_text))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.text.SpannableString
import android.text.style.ImageSpan
import android.view.Menu
import android.view.View
import android.view.accessibility.AccessibilityEvent
import androidx.core.view.isGone
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
Expand Down Expand Up @@ -144,7 +143,6 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject {
super.onResume()
viewModel.refreshTests()
viewModel.initAppShortcuts()
binding.container.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT)
}

private fun menuIconWithText(drawable: Drawable?, title: CharSequence): CharSequence {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/statistics_recyclerview"
android:accessibilityLiveRegion="assertive"
android:accessibilityTraversalBefore="@id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />