Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show categories in emoji picker #3300

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

d3d9
Copy link

@d3d9 d3d9 commented Feb 11, 2023

Categories can be defined for custom emojis in Mastodon.
For example on zug.network, there are over 1800 custom emojis and at least some categories have been introduced, which can be seen in the web interface like in the next screenshot. Meanwhile in Tusky the emojis can only be browsed alphabetically without categories.

In this PR I tried to group custom emojis by category and only sort alphabetically within the group, furthermore there's a kind of header for the emoji picker containing all the categories and highlighting the current one.

image

image

image

When scrolling the emoji grid, the header gets updated, however this bit needs to be improved to suppress this during the smooth scrolling that happens when clicking on a category:

if (binding.emojiView.layoutManager?.isSmoothScrolling == true) return // TODO needs to be improved

Besides that, I'm sure some refactoring has to be done since I probably placed some of the code in inappropriate places. The idea of using empty/fake grid items might also be controversial?

@Lakoja
Copy link
Collaborator

Lakoja commented Feb 12, 2023

Why does it need fake grid items (what is missing otherwise or in existing code)?

@d3d9
Copy link
Author

d3d9 commented Feb 12, 2023

Why does it need fake grid items (what is missing otherwise or in existing code)?

I tried using RecyclerView.ItemDecoration with method getItemOffsets and modifying the outRect, but I couldn't get that to work well.
I should probably have also tried to override the span count for specific items (make the last ones of each category take up all remaining spans), now that I think of it.
Instead, I quickly changed it to add 3 to 5 spacer grid items for now to get the space between categories.

Copy link
Collaborator

@connyduck connyduck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the feature, but I'm sorry the code is way to messy to be merged :/

Here are some ideas to improve it:

  • do the titles with a second recyclerview, xml layouts and a adapter
  • don't touch ComposeActivity at all, it is already doing too much
  • move the logic into the one of the other classes, probably EmojiPicker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants