Improve emoji picker accessibility (#944)
* set emoji shortcode as content description on ImageView * hide bottom sheets on back press
This commit is contained in:
parent
59257c7af4
commit
73670b8576
2 changed files with 18 additions and 6 deletions
|
@ -1479,6 +1479,16 @@ public final class ComposeActivity
|
|||
}
|
||||
|
||||
private void handleCloseButton() {
|
||||
|
||||
if(composeOptionsBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED ||
|
||||
addMediaBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED ||
|
||||
emojiBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED ) {
|
||||
composeOptionsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
addMediaBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
emojiBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
return;
|
||||
}
|
||||
|
||||
CharSequence contentText = textEditor.getText();
|
||||
CharSequence contentWarning = contentWarningEditor.getText();
|
||||
|
||||
|
|
|
@ -35,20 +35,22 @@ class EmojiAdapter(emojiList: List<Emoji>, private val onEmojiSelectedListener:
|
|||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EmojiAdapter.EmojiHolder {
|
||||
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_emoji_button, parent, false) as ImageView
|
||||
return EmojiHolder(view)
|
||||
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(viewHolder: EmojiAdapter.EmojiHolder, position: Int) {
|
||||
val emoji = emojiList[position]
|
||||
|
||||
Picasso.with(viewHolder.emojiImageView.context)
|
||||
.load(emojiList[position].url)
|
||||
.load(emoji.url)
|
||||
.into(viewHolder.emojiImageView)
|
||||
|
||||
viewHolder.emojiImageView.setOnClickListener {
|
||||
onEmojiSelectedListener.onEmojiSelected(emojiList[position].shortcode)
|
||||
onEmojiSelectedListener.onEmojiSelected(emoji.shortcode)
|
||||
}
|
||||
|
||||
viewHolder.emojiImageView.contentDescription = emoji.shortcode
|
||||
}
|
||||
|
||||
class EmojiHolder(val emojiImageView: ImageView) : RecyclerView.ViewHolder(emojiImageView)
|
||||
|
|
Loading…
Reference in a new issue