Upgrade to Pro — share decks privately, control downloads, hide ads and more …

EmojiPicker触ってみた

 EmojiPicker触ってみた

DeNA.apk #4で発表した内容です

napplecomputer

March 03, 2023
Tweet

More Decks by napplecomputer

Other Decks in Programming

Transcript

  1. Mobility Technologies Co., Ltd. 2 ▪ @napplecomputer ▪ ͳͬͽʔ ▪

    גࣜձࣾMobility Technologies(MoT)ॴଐ ▪ λΫγʔΞϓϦʮGOʯͷϢʔβʔΞϓϦ ▪ ࠷ۙϨϞϯͷ໦Λങ͍·ͨ͠ ࣗݾ঺հ
  2. Mobility Technologies Co., Ltd. 10 ▪ Font Providerʢ࣮࣭Google Play ServicesͷΈʣ͕μ΢ϯϩʔυͨ͠ϑΥ

    ϯτΛ୺຤಺ͷΞϓϦʹڞ༗͢Δػೳ Downloadable Fonts Device Font Provider App1 Font Font Server App2 Font
  3. Mobility Technologies Co., Ltd. 11 ▪ ΞϓϦ͕ಠࣗʹϑΥϯτΛ༻ҙ͢ΔσϝϦοτ͕ճආͰ͖Δ ▪ ΞϓϦʹϑΥϯτΛຒΊࠐΉͱΞϓϦαΠζ͕ංେԽ ▪

    ΞϓϦىಈޙʹμ΢ϯϩʔυ͢Δ৔߹΋௨৴ྔͱετϨʔδΛѹഭ ▪ ෳ਺ͷΞϓϦ͕ಉ͡ϑΥϯτΛڞ༗Ͱ͖ΔͷͰશһϋοϐʔ ▪ ͍ͭʹͳͬͨΒNoto Sans JP࢖͑ΔΑ͏ʹͳΔͷʁ Downloadable Fonts
  4. Mobility Technologies Co., Ltd. 13 ▪ Androidͷݹ͍OSͰ͸৽͍͠ֆจࣈ͕จࣈԽ͚͢Δ ▪ OSͷγεςϜϑΥϯτͷֆจࣈϑΥϯτΛ࢖ͬͯֆจࣈΛද͍ࣔͯ͠ΔͨΊɺ දࣔͰ͖Δֆจࣈ͸OSόʔδϣϯґଘ

    ▪ Android 11·Ͱ͸γεςϜϑΥϯτ͸OSΞοϓσʔτҎ֎Ͱ͸ߋ৽Ͱ͖ͳ ͍ ▪ AndroidͰ͸OS͝ͱʹUnicodeͷରԠঢ়گ͕ҧ͏ ▪ ֆจࣈͷഽͷ৭ରԠͳͲ ▪ ྫ͑͹ഽͷ৭͸ϑΥϯτ͕ߋ৽͞Εͯ΋ղܾͰ͖ͳ͍ ֆจࣈޓ׵ੑ໰୊
  5. Mobility Technologies Co., Ltd. ▪ ֆจࣈͷޓ׵ੑͷͨΊͷEmojiCompatΛ༗͢ΔϥΠϒϥϦ ▪ EmojiCompatͰ͸Donwloadable fontsΛར༻ͯ͠࠷৽ͷֆจࣈΛऔಘ ▪

    UnicodeͷରԠঢ়گ͸SpanͰղܾ ▪ ͪΐͬͱ໘౗ ▪ EmojiTextViewͳͲͷઐ༻ͷViewΛ࢖͏ඞཁ͕͋Δ ▪ ॳظԽॲཧ͕ඞཁ 15 Emoji
  6. Mobility Technologies Co., Ltd. ▪ AppCompat1.4͔ΒAppCompatʹEmojiCompat͕૊Έࠐ·Εɺ AppCompatTextViewͳͲͷAppCompatViewΛ࢖༻͢Δ͚ͩͰ࠷৽ͷֆจࣈΛදࣔ Ͱ͖ΔΑ͏ʹͳͬͨ ▪ AppCompat͔Βࢀর͢ΔͨΊʹEmojiΛ੔ཧͨ͠ͷ͕Emoji2

    ▪ Inflater͕TextViewΛAppCompatTextViewʹஔ͖׵͑ΔͨΊɺAppCompat1.4Ҏ্ Λ࢖͍ͬͯΕ͹উखʹద༻͞ΕΔ ▪ ৄ͘͠͸DroidKaigi2021ͷAndroid Emoji 2021ΛݟΑ͏ ▪ https://droidkaigi.jp/2021/timetable/277220/?day=2 17 Emoji2
  7. Mobility Technologies Co., Ltd. 26 Emoji PickerΛ࢖͏ implementation 'androidx.emoji2:emoji2-emojipicker:1.0.0-alpha02' <androidx.emoji2.emojipicker.EmojiPickerView

    xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/emoji_piker" android:layout_width="match_parent" android:layout_height="match_parent" />
  8. Mobility Technologies Co., Ltd. ▪ ButtonͷΑ͏ʹListenerΛ࢖ͬͯϢʔβʔ͕ԿΛλοϓͨ͠ͷ͔औಘͰ͖Δ ▪ આ໌௨Γਫฏํ޲ͷϔομʔͱਨ௚ํ޲ͷεΫϩʔϧͷ͋ΔView ▪ ੑผ΍ഽͷ৭ͳͲ͸௕ԡ͠Ͱ੾Γସ͑ΒΕΔ

    ▪ ௕ԡ͠Ͱ͖Δ΋ͷ͸ӈԼʹද͕ࣔ͋Δ ▪ ࠷ۙ࢖༻ͨ͠ֆจࣈ͸εΫϩʔϧ͠ͳ͍ͱߋ৽͞Εͳ͍… ▪ ԣ෯Λwrap_contentʹ͢Δͱֆจࣈ͕දࣔ͞Εͳ͍ 29 Emoji Picker
  9. Mobility Technologies Co., Ltd. 31 ▪ ΧελϚΠζͰ͖Δ߲໨ ▪ දࣔ͢Δֆจࣈ਺ͷࢦఆ ▪

    ࠷ۙ࢖ͬͨֆจࣈProviderͷมߋ Emoji PickerΛΧελϚΠζ͢Δ
  10. Mobility Technologies Co., Ltd. 32 ▪ emojiGridColumnsɺemojiGridRowsͰը໘ʹදࣔ͢Δԣํ޲ɺॎํ޲ʹ දࣔ͢Δֆจࣈ਺ΛࢦఆͰ͖Δ ▪ EmojiPickerViewͰ͸ը໘ͷى͖͞ʹ߹Θܾͤͯ·ͬͨ਺ͷֆจࣈΛදࣔ͢

    ΔͨΊɺֆจࣈ਺ΛݮΒͤ͹ֆจࣈ͕େ͖͘දࣔ͞ΕΔ ▪ ը໘αΠζʹ߹Θͤͯ਺Λมߋ͢Δ͜ͱͰֆจࣈͷେ͖͞ΛίϯτϩʔϧͰ ͖Δ දࣔ͢Δֆจࣈ਺ͷࢦఆ
  11. Mobility Technologies Co., Ltd. 34 ࠷ۙ࢖ͬͨֆจࣈProviderͷมߋ interface RecentEmojiProvider { /**

    * Records an emoji into recent emoji list. * This fun will be called when an emoji is selected. * Clients could specify the behavior to record recently used emojis.(e.g. click frequency). */ fun recordSelection(emoji: String) /** * Returns a list of recent emojis. * Default behavior: The most recently used emojis will be displayed first. * Clients could also specify the behavior such as displaying the emojis from high click * frequency to low click frequency. */ suspend fun getRecentEmojiList(): List<String> }
  12. Mobility Technologies Co., Ltd. 35 ▪ σϑΥϧτͷRecentEmojiProvider͸internalʹͳ͓ͬͯΓ֎෦͔Β͸ࢀর Ͱ͖ͳ͍ ▪ ࣮૷ΛݟΔͱSharedPreferenceʹ஋Λอଘ͍ͯ͠Δ͕ɺ஋͕ཉ͍͠৔߹

    ʹ௚઀SharedPreferenceΛݟΔͷ͸΍Ίͨ΄͏͕ྑͦ͞͏ ▪ ಠ࣮ࣗ૷ͷRecentEmojiProviderΛ࢖༻͢Δ͜ͱͰɺEmojiPickerViewΛද ࣔ͠ͳͯ͘΋࠷ۙ࢖༻ͨ͠ֆจࣈΛऔಘ͢Δ͜ͱ͕ՄೳʹͳΔ ▪ ༗ޮظݶ΍্ݶΛઃఆͨ͠Γ΋Ͱ͖Δ ࠷ۙ࢖ͬͨֆจࣈProviderͷมߋ
  13. Mobility Technologies Co., Ltd. 37 ▪ Emoji Picker͸ֆจࣈͷબ୒ʹϑΥʔΧε͓ͯ͠ΓɺViewͱͯ͠ఏڙ͞Ε͍ͯΔͨΊΞ ϓϦʹ૊ΈࠐΈ΍͍͢ ▪

    Ͱ΋ΞϓϦͰϢʔβʔʹֆจࣈ͚ͩબ୒͍ͤͨ͞৔໘ͬͯ͋Δ…ʁ ▪ ࠷ۙ࢖ͬͨֆจࣈProviderͷΧελϚΠζੑ͔Β࡯͢ΔʹɺIMEʹ૊ΈࠐΉ͜ͱΛલఏ ͱ͍ͯ͠Δͷ͔΋ ▪ ௨ৗ͸࠷ۙ࢖ͬͨֆจࣈProviderʹ͋Δֆจࣈ͚ͩΛϢʔβʔʹબ୒ͤ͞ʢͦͷը໘ͷ ࣮૷͸ඞཁʣɺ΋ͬͱଟ͘ͷֆจࣈΛબ୒ͤ͞Δͱ͖ʹEmoji PickerΛදࣔ͢ΔͳͲ Emoji Picker·ͱΊ
  14. Mobility Technologies Co., Ltd. 42 ▪ ϚχΞοΫͳֆจࣈ͕͔ΜͨΜʹೖྗͰ͖ͯศར ▪ ֦ுػೳͩͱRecentEmojiProvider׆༻͸೉͍͠ ▪

    EmojiCompatͷॳظԽॲཧ͕૸ΔͷͰىಈ͕ͪΐͬͱ஗͍ ▪ ΧελϚΠζͰ͖Δ͸ͣ ▪ ϚογϡϧʔϜͷ࢓༷ॻ͔Ε͍ͯΔαΠτ͕ফ͍͑ͯΔͷͰɺ࢓༷͸౰࣌ͷ ϒϩάͳͲΛ୳ͯ͠ؾ߹ͰಡΈऔΔ͔͠ແ͍ ϚογϡϧʔϜ͔ΒEmoji PickerΛར༻͢Δ
  15. Mobility Technologies Co., Ltd. 44 ▪ AndroidͰͷֆจࣈ͸৭ʑେม ▪ Emoji PickerΛ࢖͑͹ֆจࣈͷબ୒ը໘͸؆୯ʹ࡞ΕΔ

    ▪ ಛʹੑผͱഽͷ৭બ୒ͱ͔͸ͱͯ΋خ͍͠ ▪ Emoji Picker͸IMEΛλʔήοτʹ͍ͯͦ͠͏ ▪ ϚογϡϧʔϜͷ࢓༷͕ॻ͔Ε͍ͯΔαΠτ͸ফ͍͑ͯΔ ·ͱΊ