mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add accessibility labels for GIF categories and correct emoji labels.
This commit is contained in:
@@ -14,6 +14,7 @@ interface KeyboardPageCategoryIconMappingModel<T : KeyboardPageCategoryIconMappi
|
||||
val selected: Boolean
|
||||
|
||||
fun getIcon(context: Context): Drawable
|
||||
fun getContentDescription(context: Context): String
|
||||
}
|
||||
|
||||
class KeyboardPageCategoryIconViewHolder<T : KeyboardPageCategoryIconMappingModel<T>>(itemView: View, private val onPageSelected: Consumer<String>) : MappingViewHolder<T>(itemView) {
|
||||
@@ -27,7 +28,7 @@ class KeyboardPageCategoryIconViewHolder<T : KeyboardPageCategoryIconMappingMode
|
||||
}
|
||||
|
||||
iconView.setImageDrawable(model.getIcon(context))
|
||||
iconView.contentDescription = model.key
|
||||
iconView.contentDescription = model.getContentDescription(context)
|
||||
iconView.isSelected = model.selected
|
||||
iconSelected.isSelected = model.selected
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ class RecentsMappingModel(override val selected: Boolean) : KeyboardPageCategory
|
||||
return requireNotNull(ThemeUtil.getThemedDrawable(context, R.attr.emoji_category_recent))
|
||||
}
|
||||
|
||||
override fun getContentDescription(context: Context): String {
|
||||
return context.getString(R.string.ReactWithAnyEmojiBottomSheetDialogFragment__recents)
|
||||
}
|
||||
|
||||
override fun areItemsTheSame(newItem: RecentsMappingModel): Boolean {
|
||||
return newItem.key == key
|
||||
}
|
||||
@@ -31,6 +35,10 @@ class EmojiCategoryMappingModel(private val emojiCategory: EmojiCategory, overri
|
||||
return requireNotNull(ThemeUtil.getThemedDrawable(context, emojiCategory.icon))
|
||||
}
|
||||
|
||||
override fun getContentDescription(context: Context): String {
|
||||
return context.getString(emojiCategory.getCategoryLabel())
|
||||
}
|
||||
|
||||
override fun areItemsTheSame(newItem: EmojiCategoryMappingModel): Boolean {
|
||||
return newItem.key == key
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class GifQuickSearchAdapter(clickListener: (GifQuickSearchOption) -> Unit) : Map
|
||||
override fun bind(model: GifQuickSearch) {
|
||||
image.setImageResource(model.gifQuickSearchOption.image)
|
||||
image.isSelected = model.selected
|
||||
image.contentDescription = itemView.context.getString(model.gifQuickSearchOption.categoryLabel)
|
||||
imageSelected.isSelected = model.selected
|
||||
itemView.setOnClickListener { listener(model.gifQuickSearchOption) }
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package org.thoughtcrime.securesms.keyboard.gif
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import org.thoughtcrime.securesms.R
|
||||
|
||||
enum class GifQuickSearchOption(private val rank: Int, val image: Int, val query: String) {
|
||||
TRENDING(0, R.drawable.ic_gif_trending_24, ""),
|
||||
CELEBRATE(1, R.drawable.ic_gif_celebrate_24, "celebrate"),
|
||||
LOVE(2, R.drawable.ic_gif_love_24, "love"),
|
||||
THUMBS_UP(3, R.drawable.ic_gif_thumbsup_24, "thumbs up"),
|
||||
SURPRISED(4, R.drawable.ic_gif_surprised_24, "surprised"),
|
||||
EXCITED(5, R.drawable.ic_gif_excited_24, "excited"),
|
||||
SAD(6, R.drawable.ic_gif_sad_24, "sad"),
|
||||
ANGRY(7, R.drawable.ic_gif_angry_24, "angry");
|
||||
enum class GifQuickSearchOption(private val rank: Int, val image: Int, val query: String, @StringRes val categoryLabel: Int) {
|
||||
TRENDING(0, R.drawable.ic_gif_trending_24, "", R.string.GifQuickSearchOption__trending),
|
||||
CELEBRATE(1, R.drawable.ic_gif_celebrate_24, "celebrate", R.string.GifQuickSearchOption__celebrate),
|
||||
LOVE(2, R.drawable.ic_gif_love_24, "love", R.string.GifQuickSearchOption__love),
|
||||
THUMBS_UP(3, R.drawable.ic_gif_thumbsup_24, "thumbs up", R.string.GifQuickSearchOption__thumbs_up),
|
||||
SURPRISED(4, R.drawable.ic_gif_surprised_24, "surprised", R.string.GifQuickSearchOption__surprised),
|
||||
EXCITED(5, R.drawable.ic_gif_excited_24, "excited", R.string.GifQuickSearchOption__excited),
|
||||
SAD(6, R.drawable.ic_gif_sad_24, "sad", R.string.GifQuickSearchOption__sad),
|
||||
ANGRY(7, R.drawable.ic_gif_angry_24, "angry", R.string.GifQuickSearchOption__angry);
|
||||
|
||||
companion object {
|
||||
val ranked: List<GifQuickSearchOption> by lazy { entries.sortedBy { it.rank } }
|
||||
|
||||
@@ -3730,6 +3730,7 @@
|
||||
<string name="DebugLogsPromptDialogFragment__no_thanks">No thanks</string>
|
||||
|
||||
<!-- ReactWithAnyEmojiBottomSheetDialogFragment -->
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__recents">Recents</string>
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__this_message">This Message</string>
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__recently_used">Recently Used</string>
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__smileys_and_people">Smileys & People</string>
|
||||
@@ -3743,6 +3744,17 @@
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__emoticons">Emoticons</string>
|
||||
<string name="ReactWithAnyEmojiBottomSheetDialogFragment__no_results_found">No results found</string>
|
||||
|
||||
<!-- GifQuickSearchOption -->
|
||||
<string name="GifQuickSearchOption__recents">Recents</string>
|
||||
<string name="GifQuickSearchOption__trending">Trending</string>
|
||||
<string name="GifQuickSearchOption__celebrate">Celebrate</string>
|
||||
<string name="GifQuickSearchOption__love">Love</string>
|
||||
<string name="GifQuickSearchOption__thumbs_up">Thumbs Up</string>
|
||||
<string name="GifQuickSearchOption__surprised">Surprised</string>
|
||||
<string name="GifQuickSearchOption__excited">Excited</string>
|
||||
<string name="GifQuickSearchOption__sad">Sad</string>
|
||||
<string name="GifQuickSearchOption__angry">Angry</string>
|
||||
|
||||
<!-- arrays.xml -->
|
||||
<string name="arrays__use_default">Use default</string>
|
||||
<string name="arrays__use_custom">Use custom</string>
|
||||
|
||||
Reference in New Issue
Block a user