googlearchive / android-emojicompat Goto Github PK
View Code? Open in Web Editor NEWMigrated:
Home Page: https://github.com/android/user-interface
License: Apache License 2.0
Migrated:
Home Page: https://github.com/android/user-interface
License: Apache License 2.0
Anyone success in using downloadable font for the sample? The bundle one works okay, but when I change the USE_BUNDLED_EMOJI to false and I run in [samsung s6 5.0, emulator 21 and 19] they crash right away with this stack:
08-02 17:46:50.652 19568-19585/com.example.android.emojicompat E/AndroidRuntime: FATAL EXCEPTION: fonts
Process: com.example.android.emojicompat, PID: 19568
java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1546)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:420)
at android.content.ContentResolver.query(ContentResolver.java:488)
at android.content.ContentResolver.query(ContentResolver.java:432)
at android.support.v4.provider.FontsContractInternal.getFontFromProvider(FontsContractInternal.java:239)
at android.support.v4.provider.FontsContractInternal$2.run(FontsContractInternal.java:133)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
I am working on a chat libraray. I am displaying messages using android.support.text.emoji.widget.EmojiAppCompatTextView. I am receiving unicode from IOS device for emojis. android.support.text.emoji.widget.EmojiAppCompatTextView is showing unicode instead of converting it to emoji. How I can convert and display that as emoji?
String message = "\ud83d\ude0f"; //message received from IOS device.
emojiEditText.setText(message);
It is not converting to Emoji.
To test, I have entered the message statically while launching the application. Then, it is showing emoji.
Please help me if you know the solution.
I'm using the new androidx dependency in my project and i have a custom font in the font resource directory that is applied through the overall theme of the app. The font is not displayed on the Emoji widgets but it is successfully displayed on every other widget.
implementation "androidx.emoji:emoji-bundled:1.0.0"
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:fontFamily">@font/montserrat_bold</item> </style>
I ran the sample on a couple devices with Android 7 and the downloaded font sometimes doesn't show the correct emoji.
If I use the bundled version, everything is fine.
I noticed this when trying to display flags, like πΊπΈ \uD83C\uDDFA\uD83C\uDDF8
, and all I got was a flag with a question mark on it, like this:
Downloaded on the left, bundled on the right.
Tried on 3 different Android 7 devices, with Google Play Services 11.7.45 or 11.9.51 and one Android 6 with both Google Play Services versions.
Eventually I figured that not doing setReplaceAll(true)
on the FontRequestEmojiCompatConfig()
seems "help" since Android knows how to display most countries.
I made an example with all flags copy&pasted from http://emojiflags.com and placed the yoga emoji on the second field (it's from the latest Emoji version so, the Android shouldn't be able to display it without EmojiCompat).
[ Download+setReplaceAll(false)
| Download+setReplaceAll(true)
| Bundled+setReplaceAll(true)
]
What's wrong with the downloaded version?
I replaced the text with code U+1F396 (π) by code [new String(Character.toChars(0x1f396))].
But the icon not show in the device HTC One M8 (show an invalid icon), I used the downloadable font and see the log the initialization is successful.
There are a lot of icons not shown too.
How do I get Emojis displayed/entered in TextView/EditText as unicode for sending it to server?
Expected Output
User enter this emoji: π©β
When editText.getText().toString() is performed, it shoud result into: \uD83D\uDC69
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.