Merge pull request #7016 from vector-im/bugfix/eric/new-layout-accessibility-fixes

New Layout Accessibility Fixes
This commit is contained in:
Eric Decanini 2022-09-06 08:25:29 +02:00 committed by GitHub
commit e2ba576318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 4 deletions

1
changelog.d/7016.wip Normal file
View File

@ -0,0 +1 @@
[New Layout] Improves talkback accessibility

View File

@ -140,8 +140,10 @@
<string name="start_chat">Start Chat</string>
<string name="create_room">Create Room</string>
<string name="explore_rooms">Explore Rooms</string>
<string name="a11y_expand_space_children">Expand space children</string>
<string name="a11y_collapse_space_children">Collapse space children</string>
<!-- Note to translators: %s refers to the space whose children is being expanded -->
<string name="a11y_expand_space_children">Expand %s children</string>
<!-- Note to translators: %s refers to the space whose children is being collapsed -->
<string name="a11y_collapse_space_children">Collapse %s children</string>
<!-- Last seen time -->

View File

@ -58,7 +58,10 @@ abstract class NewSpaceSummaryItem : VectorEpoxyModel<NewSpaceSummaryItem.Holder
holder.chevron.setOnClickListener(onToggleExpandListener)
holder.chevron.isVisible = hasChildren
holder.chevron.setImageResource(if (expanded) R.drawable.ic_expand_more else R.drawable.ic_arrow_right)
holder.chevron.contentDescription = context.getString(if (expanded) R.string.a11y_collapse_space_children else R.string.a11y_expand_space_children)
holder.chevron.contentDescription = context.getString(
if (expanded) R.string.a11y_collapse_space_children else R.string.a11y_expand_space_children,
matrixItem.displayName,
)
avatarRenderer.render(matrixItem, holder.avatar)
holder.unreadCounter.render(countState)

View File

@ -50,6 +50,7 @@ abstract class NewSubSpaceSummaryItem : VectorEpoxyModel<NewSubSpaceSummaryItem.
override fun bind(holder: Holder) {
super.bind(holder)
val context = holder.root.context
holder.root.onClick(onSubSpaceSelectedListener)
holder.name.text = matrixItem.displayName
holder.root.isChecked = selected
@ -63,6 +64,10 @@ abstract class NewSubSpaceSummaryItem : VectorEpoxyModel<NewSubSpaceSummaryItem.
)
holder.chevron.onClick(onToggleExpandListener)
holder.chevron.isVisible = hasChildren
holder.chevron.contentDescription = context.getString(
if (expanded) R.string.a11y_collapse_space_children else R.string.a11y_expand_space_children,
matrixItem.displayName,
)
holder.indent.isVisible = indent > 0
holder.indent.updateLayoutParams {

View File

@ -127,7 +127,6 @@
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@id/roomListView"
android:contentDescription="@string/a11y_create_message"
android:src="@drawable/ic_new_chat"
android:visibility="gone"

View File

@ -50,6 +50,7 @@
android:layout_marginTop="4dp"
android:layout_marginBottom="16dp"
android:ellipsize="end"
android:importantForAccessibility="no"
android:lines="1"
android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toBottomOf="parent"