Use system emoji uniformly accross app when system emoji option is enabled #13327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First time contributor checklist
Contributor checklist
Fixes #1234
syntaxDescription
Hi! I'm a long time Signal user and fan! However, there is one thing that has bugged me about the app, and that's the inconsistency of emoji when using the system emoji option. I've found some others have the same sentiment on the forum and in Github issues.
The comments from the Signal team I've seen didn't specify what the blocking technical issues were so I took a look at the code base and found this solution. I created an alternate drawable that leverages StaticLayout and the EmojiCompat library to draw the system emoji directly, and have the emoji provider return these drawables when the system emoji option is enabled. This should behave consistently with emoji in TextViews because AppCompat uses EmojiCompat under the hood to render glyphs with the system font where possible, while falling back to a font provided by Google Play Services for missing glyphs.
I tested this on my Pixel 8 Pro as well as on an Android 10 emulator and an Android 5.0 emulator (to demonstrate that EmojiCompat works and cover the SDK_INT check around the StaticLayout constructor). One thing to note when testing on an emulator is that there seems to be a known issue with EmojiCompat not pulling the fallback font on emulators, so to test those I used the EmojiCompat bundled configuration in my
use-system-emoji-bundled
branch. Below are some screenshots of the reactions picker to show the emojis working across Android versions and demonstrate that the EmojiCompat fallback works so outdated Android devices will not be missing any glyphs.Android 14
Android 10 with EmojiCompat
Android 10 without EmojiCompat
Android 5 with EmojiCompat
Android 5 without EmojiCompat
Thanks for your consideration!