sk22 / megalodon

Pink modification of the official Mastodon for Android app
https://sk22.github.io/megalodon
GNU General Public License v3.0
546 stars 35 forks source link

Reworking the custom emoji picker #573

Open Jacocococo opened 1 year ago

Jacocococo commented 1 year ago

Is your feature request related to a problem? Please describe. The current emoji picker will just show a long list of all emoji, and on a server where there are a lot of emoji, like one I'm on that has well over a thousand, it's needed to scroll through the entire list to see the emoji in a category towards the bottom. There are also no Unicode emoji in it, so people who use keyboards that don't have emoji can't even use them

Describe the solution you'd like I think it would make sense to have different tabs for the categories, and then it would also make sense to have one for Unicode emoji. To search through custom emoji right now, the user would type it out in the text field, but I think it would also make sense to search directly in the picker, especially if it gets Unicode emoji support. It would also make #437 easier to implement if it showed Unicode emoji

Describe alternatives you've considered If it was to show Unicode emoji without tabs they would take up a lot of space in the picker, so I think tabs would kind of be necessary

Additional context Akkoma's web UI has an emoji picker like this and I think it works quite well. Mastodon's also does, but the tabs only scroll through the long list whereas Akkoma's will only show emoji in a specific category until another one is selected. I personally prefer Akkoma's approach here, which is what's shown in the screenshot image

Jacocococo commented 11 months ago

While I don't plan to implement this myself, I have looked into how it could be done to help anyone who would be interested in doing it

Each category is already split into being its own adapter that is then combined with the others in a MergeRecyclerAdapter. This means that "all" that needs to be done to only show one at a time is to make sure the MergeRecyclerAdapter only contains the element for the specified category. Alternatively, the code list.scrollToPosition(adapter.getPositionForAdapter(adapter.getAdapterAt(<index>))) can be used to just scroll to a category if all categories should be shown at the same time, though this line doesn't seem to scroll quite far enough when scrolling from above to below

The adapter is already wrapped in a LinearLayout, so a search field and display elements for choosing categories could probably be added to that

And in terms of letting the user pick Unicode emoji, the app could probably store a local copy of https://unicode.org/Public/emoji/latest/emoji-test.txt or something similar for a list of all emoji and parse it, either on start-up and keeping it in memory or parsing it every time it's needed