EmojiCompat support#600
Conversation
…in a file somewhere inside the device's storage
Emoji font should now be located at [Private external app directory]/files/EmojiCompat.ttf
# Conflicts: # app/build.gradle # app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java
Since this EmojiCompat-implementation does not rely on BundledEmojiCompat, there's no reason to have it enabled.
Since connection isn't assigned to (I tried doing so), it can be declared final/val again.
|
Wow, that's wonderful, thank you! |
|
These two configurations are used because of some issues if the EmojiCompat font is missing. This solution ensures that the user is able to
A more user-friendly solution would be to make the fonts available online and to add an option (e.g. in Settings) to download one of them. |
|
Thank you a lot! ❤️ |
|
But |
|
Ok this is super awesome, but not yet userfriendly enough. Users should be able to select their preferred style in the settings + then we download the file to the device. I can implement that if you dont want to. |
|
@connyduck I can try adding this option, but I'm not very sure about these things 😅 |
|
@C1710 What are your concerns? |
|
I don't know how Tusky handles all these things with settings and so on😂 - integrating EmojiCompat was relatively easy though... |
I would do it the following way: Add a new On appstart, check the shared preferences for the selected style and then check if the required font file exists. If so, use it, otherwise fall back to default. I can help you if you have questions about implementation details
We could put it on https://tuskyapp.github.io/ ? |
# Conflicts: # app/src/main/res/values/strings.xml
|
I just finished the implementation of EmojiCompat!
But there are a few things I can't do:
Please be aware that I currently use a different branch than the one I started the pull request from |
|
Oh and another issue is that you'll need to restart the app to select a new emoji font since @google blocked classes from outside the EMojiCompat library itself resetting the configuration 🤷♀️ |
charlag
left a comment
There was a problem hiding this comment.
That's a super cool and hard work
Of course I'm going to grunt anyway :D
I'd rather see new code in Kotlin but I'm not sure that you're comfortable with it.
I have thoughts that maybe we should put fonts in another repo? Because first, I'm not sure how they're licensed and second, people won't have to download fonts when they're downloading source code.
| * @return the corresponding font. Will default to SYSTEM_DEFAULT if not in range. | ||
| */ | ||
| public static EmojiCompatFont byId(int id) { | ||
| if(id >= 0 && id < FONTS.length) { |
There was a problem hiding this comment.
This formatting of if/else makes me sad
|
About Kotlin: I think I'm able to read code written in Kotlin, but I'm not sure that I'm able to actually write code in Kotlin. |
connyduck
left a comment
There was a problem hiding this comment.
This is getting really good ^___^
Unfortunately it is not working anymore for me, it seems the folder where the emojis get stored is not created correctly?
Also I think EmojiTextView should be used conservatively, as it has a (small) perf setback over standard TextView. Usernames can not contain emojis, so no need to use EmojiTextView where only usernames are displayed.
| android:paddingTop="24dp"> | ||
|
|
||
| <TextView | ||
| <android.support.text.emoji.widget.EmojiTextView |
There was a problem hiding this comment.
Better leave it a TextView, its guaranteed to not contain emojis
| @@ -0,0 +1,11 @@ | |||
| <vector android:height="24dp" android:viewportHeight="128" | |||
| android:viewportWidth="128" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |||
There was a problem hiding this comment.
android:height and android:width need to be 40dp or it will look blurry on some devices
| @@ -0,0 +1,9 @@ | |||
| <vector android:height="24dp" android:viewportHeight="36" | |||
There was a problem hiding this comment.
android:height and android:width need to be 40dp or it will look blurry on some devices
| PendingIntent mPendingIntent = PendingIntent.getActivity( | ||
| context, | ||
| // This is the codepoint of the party face emoji :D | ||
| 0x1f973, |
| @@ -0,0 +1,19 @@ | |||
| [ | |||
There was a problem hiding this comment.
File not needed anymore?
| implementation('com.mikepenz:materialdrawer:6.0.7@aar') { | ||
| transitive = true | ||
| } | ||
| // GSON is used to parse the EmojiCompat font-list |
There was a problem hiding this comment.
you can remove this? (gson is included anyway via the retrofit converter)
There was a problem hiding this comment.
Are you sure that this is a good idea? If we're depending on Gson not only for network than it's not bad to mention it explicitly?
Theoretically: we're getting rid of convertor. The person removes it. Other part of the app breaks. No good.
There was a problem hiding this comment.
Yes I agree, but GSON usage has been removed from this PR I cant find it anymore?
There was a problem hiding this comment.
Oops, sorry, my bad, I fail to keep up with this fast-changing PR 😅
|
I just added all these changes including the removal of the GSON dependency. |
|
Information about the emoji font's licensing is now available in the About screen. |
Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com>
Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com>
Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com>
Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com>
* Add EmojiCompat * EmojiCompat doesn' replace all emojis anymore * This app should be now capable of loading a EmojiCompat-font located in a file somewhere inside the device's storage * Should now replace all emojis * Add EmojiCompat support to EditTextTyped * Provide EmojiCompat fonts * The app won't crash anymore when no emoji font is available. Emoji font should now be located at [Private external app directory]/files/EmojiCompat.ttf * Removed BundledEmojiCompat dependency Since this EmojiCompat-implementation does not rely on BundledEmojiCompat, there's no reason to have it enabled. * Update EditTextTyped.kt Since connection isn't assigned to (I tried doing so), it can be declared final/val again. * Update README.md * Add some non-working emoji preferences * Add a short font list for testing * Finished implementation * Add Twemoji to font list * Update documentation, more comments * Delete AssetEmojiCompat which is obsolete now * Update the font list * Update the font list * Fix font list & add Exception handling for malformed JSON files (hopefully) * More fixes. It should work now... * Removed AssetEmojiCompat (again) * Add most of the changes * Improved the EmojiCompat dialog's style * The font list is now based on a static layout without external files * Re-add the real font URL for Twemoji * Emoji-font captions are now translatable * Removed one unused String (loading) * Removed emoji fonts from this repo * Applied changes from the PR change requests * The correct emoji font will be selected after cancelling a change * Add details on the EmojiCompat fonts available (not shown yet) * Add licensing information on Twemoji and Blobmoji * Reworked some strings * Moved FileEmojiCompat to its own library * Update FileEmojiCompat to the latest version (1.0.3) * EmojiCompat bug should be fixed * Better handling of failed downloads * Removed one TODO Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com> * Update emoji attribution strings Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com> * Fixed some misspelled strings Signed-off-by: Constantin A <10349490+C1710@users.noreply.github.com>
So I finally added EmojiCompat :D
Please note that I don't know anything about license compatibility...
There are currently two fonts available: Twemoji and Blobmoji.
The font is loaded from the apps private external storage folder (
/storage/emulated/0/Android/data/com.keylesspalace.tusky/files/EmojiCompat.ttf).This method ensures that using EmojiCompat is optional (it will use a dummy configuration if no font is present) and customizable.
It should work on any component expect for the Account Header in the Navigation Drawer.