Improve emoji picker accessibility (#944)

* set emoji shortcode as content description on ImageView

* hide bottom sheets on back press
main
Konrad Pozniak 6 years ago committed by GitHub
parent ee1b676d43
commit 80afc5f0fd
  1. 10
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  2. 14
      app/src/main/java/com/keylesspalace/tusky/adapter/EmojiAdapter.kt

@ -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)
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…
Cancel
Save