Adds space name to expand / collapse chevron content description in space bottom sheet

This commit is contained in:
ericdecanini 2022-09-05 20:28:11 +02:00
parent efe5eb0501
commit 05f7850a01
3 changed files with 13 additions and 3 deletions

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 {