Skip to content

Commit d1a3933

Browse files
committed
fix: set space name, subtitle and menu dynamically for accessibility
1 parent 707b8d8 commit d1a3933

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/SpacesListAdapter.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ class SpacesListAdapter(
6060
listener.onItemClick(space)
6161
}
6262
spacesListItemCard.setAccessibilityRole(className = Button::class.java)
63+
spacesListItemName.contentDescription = holder.itemView.context.getString(R.string.content_description_space_name, space.name)
64+
spacesThreeDotMenu.contentDescription = holder.itemView.context.getString(R.string.content_description_space_three_dot_menu, space.name)
65+
spacesListItemSubtitle.contentDescription = holder.itemView.context.getString(R.string.content_description_space_subtitle,
66+
space.description)
6367

6468
if (space.isPersonal && !isMultiPersonal) {
6569
spacesListItemName.text = holder.itemView.context.getString(R.string.bottom_nav_personal)

owncloudApp/src/main/res/layout/spaces_list_item.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
android:textColor="@color/textColor"
7575
android:textSize="18sp"
7676
android:textStyle="bold"
77-
android:contentDescription="@string/content_description_space_name"
7877
tools:text="Name" />
7978

8079
<ImageView
@@ -86,7 +85,6 @@
8685
android:clickable="true"
8786
android:focusable="true"
8887
android:background="?android:attr/selectableItemBackground"
89-
android:contentDescription="@string/content_description_space_three_dot_menu"
9088
app:layout_constraintEnd_toEndOf="parent"
9189
app:layout_constraintTop_toTopOf="parent"
9290
app:layout_constraintBottom_toBottomOf="parent"/>
@@ -102,7 +100,6 @@
102100
android:singleLine="true"
103101
android:textColor="@color/textColor"
104102
android:textSize="15sp"
105-
android:contentDescription="@string/content_description_space_subtitle"
106103
tools:text="Subtitle" />
107104

108105
</LinearLayout>

owncloudApp/src/main/res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,9 +821,9 @@
821821
<string name="content_description_sort_by_name_descending">Sort by %1$s descending</string>
822822
<string name="content_description_create_new_folder">Create new folder</string>
823823
<string name="content_description_space_image">Space image</string>
824-
<string name="content_description_space_name">Space name</string>
825-
<string name="content_description_space_three_dot_menu">Space menu</string>
826-
<string name="content_description_space_subtitle">Space subtitle</string>
824+
<string name="content_description_space_name">%1$s space name</string>
825+
<string name="content_description_space_three_dot_menu">%1$s space menu</string>
826+
<string name="content_description_space_subtitle">%1$s space subtitle</string>
827827

828828
<string name="create_shortcut_dialog_title">Create a shortcut</string>
829829
<string name="create_shortcut_dialog_url">URL</string>

0 commit comments

Comments
 (0)