Skip to content

Commit

Permalink
ANDROID-14490 expose content description in sheet actions (#339)
Browse files Browse the repository at this point in the history
* ANDROID-14490 update bottom sheet actions to expose contentDescription

* ANDROID-14490 add AccesibilityElementType
  • Loading branch information
jeprubio authored Apr 3, 2024
1 parent e0e1864 commit d2661a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ data class RowSelectable(
data class RowAction(
val id: String,
val title: String,
val contentDescription: String? = null,
val style: RowActionStyle = RowActionStyle.Default,
@Deprecated("Use new field rowAsset. RowAsset will have preference over asset")
val asset: Drawable? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal sealed class ListElementViewData(
override val id: String,
val onClickListener: OnClickListener,
val title: String,
val contentDescription: String,
val rowActionStyle: RowActionStyleViewData = RowActionStyleViewData.Default,
val asset: RowAssetViewData?,
) : ListElementViewData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal class ActionsListAdapter(val items: List<RowActionViewData>) : Recycler
override fun onBindViewHolder(holder: ActionsListViewHolder, position: Int) {
val item = items[position]
holder.text.text = item.title
holder.text.contentDescription = item.contentDescription
if (item.asset != null) {
holder.icon.loadRowAsset(item.asset)
holder.icon.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ private fun RowAction.mapToViewData(childrenId: String, onBottomSheetClicked: In
}
},
title = title,
contentDescription = contentDescription ?: title,
asset = getRowAssetViewData(asset, rowAsset),
rowActionStyle = when (style) {
RowActionStyle.Default -> RowActionStyleViewData.Default
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.telefonica.mistica.util

enum class AccesibilityElementType {
Button,
Link,
}

0 comments on commit d2661a8

Please sign in to comment.