9. Emotions
Source: People interpret the same emoji in completely different ways
https://www.theverge.com/2016/4/11/11406944/emoji-meaning-difference-ios-android
11. Extra-short-intro to Unicode
Hello
U+0048 U+0065 U+006C U+006C U+006F
Unicode: Single character set that contains ALL characters of the Universe
Each character maps to a Codepoint
A Codepoint may be represented in memory differently!
Codepoint UTF-8 UTF-16
H U+0048 48 0048
😂 U+1F602 F0 9F 98 82 D83D DE02
12. How Emoji works
Emoji: Graphic representation of one or more Unicode chars (Codepoints)
"Face With Tears of Joy” U+1F602
val emoji = "uD83DuDE02"
13. How Emoji works
“Woman Technologist: Medium-Dark Skin Tone”
val emoji = “uD83DuDC69uD83CuDFFEu200DuD83DuDCBB"
👩 U+1F469
🏾 U+1F3FE
U+200D
💻 U+1F4BB
14. How long is an Emoji?
Challenge: How many “Woman Technologist: Medium-Dark Skin Tone”
Emojis can you fit on a Tweet?
A: 280
B: 140
C: 40
Solution: 40
🤔🤔🤔🤔🤔🤔🤔🤔
280 / 7 = 40
15. How long is an Emoji? —> Improvement
emoji.length = 7
emoji.codePointCount(0, emoji.length) = 4
val emoji = “uD83DuDC69uD83CuDFFEu200DuD83DuDCBB"
16. How long is an Emoji? —> Improvement
val it = BreakIterator.getCharacterInstance()
it.setText(emoji)
var count = 0
while (it.next() != BreakIterator.DONE) {
count++
} count = 3 on API 23
count = 1 on API 25
20. Finding Emoji on Strings
Get a nice dictionary: EmojiOne “emoji.json”: 1.38 MB!
Fast JSON parsing: com.jsoniter —> but you won’t need to 😉
Efficient pattern matching —> Regular Expression
36. EmojiCompat: Setup (downloadable)
Downloadable fonts get updated automatically!
Find it in data/data/com.google.android.gms/files/fonts/opentype
Noto_Color_Emoji_Compat-400-100_0-0_0.ttf
Version 2.003;GOOG;noto-emoji:20171030:a5efe6ca61db
41. EmojiCompat: Using the Views
<android.support.text.emoji.widget.EmojiTextView/>
<android.support.text.emoji.widget.EmojiEditText/>
<android.support.text.emoji.widget.EmojiButton/>