Sort by category in emoji picker (#4533)

Emojis are sorted by category within the emoji picker. The original
alphabetical sorting is preserved within categories.

This partially addresses #1868 and is only a small part of what is done
in #3300, but I think it is still enough to improve quality of life for
users.
This commit is contained in:
autay27 2024-06-29 18:38:27 +01:00 committed by GitHub
parent b1f7e24a93
commit 9268562860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class EmojiAdapter(
private val emojiList: List<Emoji> = emojiList.filter { emoji -> emoji.visibleInPicker } private val emojiList: List<Emoji> = emojiList.filter { emoji -> emoji.visibleInPicker }
.sortedBy { it.shortcode.lowercase(Locale.ROOT) } .sortedBy { it.shortcode.lowercase(Locale.ROOT) }
.sortedBy { it.category?.lowercase(Locale.ROOT) ?: "" }
override fun getItemCount() = emojiList.size override fun getItemCount() = emojiList.size

View File

@ -26,5 +26,6 @@ data class Emoji(
val shortcode: String, val shortcode: String,
val url: String, val url: String,
@Json(name = "static_url") val staticUrl: String, @Json(name = "static_url") val staticUrl: String,
@Json(name = "visible_in_picker") val visibleInPicker: Boolean = true @Json(name = "visible_in_picker") val visibleInPicker: Boolean = true,
val category: String?
) : Parcelable ) : Parcelable