1
0
Fork 0

For #1383 Added tab title to close button content description

master
mcarare 2019-09-24 10:41:27 +03:00
parent 057451178c
commit bfe8bf4663
3 changed files with 7 additions and 1 deletions

View File

@ -96,6 +96,7 @@ class TabViewHolder(
updateSelected(tab.selected ?: false)
updatePlayPauseButton(tab.mediaState ?: MediaState.None)
item_tab.transitionName = "$TAB_ITEM_TRANSITION_NAME${tab.sessionId}"
updateCloseButtonDescription(tab.title)
}
internal fun updatePlayPauseButton(mediaState: MediaState) {
@ -136,6 +137,10 @@ class TabViewHolder(
internal fun updateSelected(selected: Boolean) {
selected_border.visibility = if (selected) View.VISIBLE else View.GONE
}
private fun updateCloseButtonDescription(title: String) {
close_tab_button.contentDescription =
close_tab_button.context.getString(R.string.close_tab_title, title)
}
companion object {
private const val TAB_ITEM_TRANSITION_NAME = "tab_item"

View File

@ -83,7 +83,6 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:alpha="0.8"
android:contentDescription="@string/close_tab"
android:src="@drawable/ic_close"
android:background="?android:attr/selectableItemBackgroundBorderless"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -355,6 +355,8 @@
<string name="add_tab">Add tab</string>
<!-- Content description (not visible, for screen readers etc.): Close tab button. Closes the current session when pressed -->
<string name="close_tab">Close tab</string>
<!-- Content description (not visible, for screen readers etc.): Close tab <title> button. First parameter is tab title -->
<string name="close_tab_title">Close tab %s</string>
<!-- Content description (not visible, for screen readers etc.): Opens the open tabs menu when pressed -->
<string name="open_tabs_menu">Open tabs menu</string>
<!-- Open tabs menu item to close all tabs -->