|
1 |
| -# Android Emojify [](https://jitpack.io/#anitrend/android-emojify) [](https://www.codacy.com/gh/AniTrend/android-emojify/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AniTrend/android-emojify&utm_campaign=Badge_Grade) [](https://github.com/AniTrend/android-emojify/actions/workflows/android-test.yml) |
| 1 | +# Android Emojify [](https://jitpack.io/#anitrend/android-emojify) [](https://www.codacy.com/gh/AniTrend/android-emojify/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AniTrend/android-emojify&utm_campaign=Badge_Grade) [](https://github.com/AniTrend/android-emojify/actions/workflows/android-test.yml) |
2 | 2 |
|
3 | 3 | [](https://app.fossa.io/projects/git%2Bgithub.com%2FAniTrend%2Fandroid-emojify?ref=badge_large)
|
4 | 4 |
|
@@ -36,114 +36,6 @@ emojis from [emojipedia](https://emojipedia.org/)**
|
36 | 36 | returned [Spanned](https://developer.android.com/reference/android/text/Spanned.html) from
|
37 | 37 | whichever framework you're using. (See sample in project)
|
38 | 38 |
|
39 |
| -## Migration |
40 |
| - |
41 |
| -### From v0.x.x - v1.x.x |
42 |
| - |
43 |
| -A quick run overview of some of the changes, see the rest of the changes under __Examples__ |
44 |
| -section. `EmojiManager.initEmojiData` has also been refactored |
45 |
| -to throw exceptions rather than consuming them. |
46 |
| - |
47 |
| -> See the __Getting Started__ section, and you can find more example in the library unit tests, |
48 |
| -> e.g. `EmojiUtilTest.kt` |
49 |
| -
|
50 |
| -```java |
51 |
| -import io.wax911.emojify.EmojiUtils; //becomes -> io.wax911.emojify.parser.EmojiParser; |
52 |
| - |
53 |
| -EmojiUtils.emojify(); //becomes -> EmojiParser.parseToUnicode(); |
54 |
| -EmojiUtils.htmlify (); //becomes -> EmojiParser.parseToHtmlDecimal(); |
55 |
| -EmojiUtils.hexHtmlify(); //becomes -> EmojiParser.parseToHtmlHexadecimal(); |
56 |
| -EmojiUtils.shortCodify(); //becomes -> EmojiParser.parseToAliases(); |
57 |
| -``` |
58 |
| - |
59 |
| -> Starting v1.X conversion is only possible from `emoji -> hexHtml, decHtml or shortCodes` |
60 |
| -> and `hexHtml, decHtml or shortCodes -> emoji` |
61 |
| -> unlike in previous versions where you could convert hexHtml to decHtml or shortCodes & vice-versa. |
62 |
| -> |
63 |
| -> ``` |
64 |
| -> . |
65 |
| -> ├── io |
66 |
| -> │ └── wax911 |
67 |
| -> │ └── emojify |
68 |
| -> │ ├── EmojiManager.kt |
69 |
| -> │ ├── model |
70 |
| -> │ │ └── Emoji.kt |
71 |
| -> │ ├── parser |
72 |
| -> │ │ └── EmojiParser.kt |
73 |
| -> │ └── util |
74 |
| -> │ ├── EmojiTrie.kt |
75 |
| -> │ └── Fitzpatrick.kt |
76 |
| -> ``` |
77 |
| -> |
78 |
| -> __N.B Package names have been changed and would require refactoring, except for `EmojiManager`__ |
79 |
| -
|
80 |
| -### |
81 |
| -
|
82 |
| -### From v1.x.x - v1.6.0 |
83 |
| -
|
84 |
| -Starting from **v1.6.0** the project has had some parts rewritten, specifically `EmojiParser` |
85 |
| -, `EmojiManager` and added support |
86 |
| -for **[androidx.startup](https://developer.android.com/topic/libraries/app-startup#kotlin)** please |
87 |
| -take the time to read the short description on what this does. |
88 |
| -
|
89 |
| -> __See [CHANGELOG.md](./CHANGELOG.md) for a detailed list of changes__ |
90 |
| -
|
91 |
| -#### Summary of changes |
92 |
| -
|
93 |
| -- `EmojiManager` has been converted from an `object` to a class with the following |
94 |
| - signature: `class EmojiManager(val emojiList: Collection<Emoji>)`. This has been done to allow ** |
95 |
| - you** to use your own emoji list and no longer required to explicitly initialize anything as |
96 |
| - previously with a call to `EmojiManager.initEmojiData` |
97 |
| -- `EmojiParser` has been converted to a set of extension function that are applied on |
98 |
| - the `EmojiManager` see examples below: |
99 |
| -
|
100 |
| - ```kotlin |
101 |
| - // getting our emoji manager from our application class through an extension function |
102 |
| - // see ./app/src/main/java/io/wax911/emojifysample/App.kt |
103 |
| - val emojiManager = context.emojiManager() |
104 |
| - EmojiParser.parseToUnicode(); //becomes -> emojiManager.parseToUnicode(); |
105 |
| - EmojiParser.parseToHtmlDecimal (); //becomes -> emojiManager.parseToHtmlDecimal(); |
106 |
| - EmojiParser.parseToHtmlHexadecimal(); //becomes -> emojiManager.parseToHtmlHexadecimal(); |
107 |
| - EmojiParser.parseToAliases(); //becomes -> emojiManager.parseToAliases(); |
108 |
| - ``` |
109 |
| -
|
110 |
| -##### New project structure |
111 |
| - |
112 |
| -> ```sh |
113 |
| -> . |
114 |
| -> └── io |
115 |
| -> └── wax911 |
116 |
| -> └── emojify |
117 |
| -> ├── EmojiManager.kt |
118 |
| -> ├── initializer |
119 |
| -> │ └── EmojiInitializer.kt |
120 |
| -> ├── manager |
121 |
| -> │ └── IEmojiManager.kt |
122 |
| -> ├── model |
123 |
| -> │ └── Emoji.kt |
124 |
| -> ├── parser |
125 |
| -> │ ├── action |
126 |
| -> │ │ └── FitzpatrickAction.kt |
127 |
| -> │ ├── candidate |
128 |
| -> │ │ ├── AliasCandidate.kt |
129 |
| -> │ │ └── UnicodeCandidate.kt |
130 |
| -> │ ├── common |
131 |
| -> │ │ └── EmojiTransformer.kt |
132 |
| -> │ ├── EmojiParser.kt |
133 |
| -> │ └── transformer |
134 |
| -> │ └── EmojiTransformer.kt |
135 |
| -> └── util |
136 |
| -> ├── EmojiTree.kt |
137 |
| -> ├── Fitzpatrick.kt |
138 |
| -> └── tree |
139 |
| -> ├── Matches.kt |
140 |
| -> └── Node.kt |
141 |
| -> ``` |
142 |
| -> __N.B `EmojiManger` has been converted to class, thus an instance needs to be obtained |
143 |
| -from `EmojiInitializer` |
144 |
| -through [androidx.startup](https://developer.android.com/topic/libraries/app-startup#disable-individual#kotlin) |
145 |
| -or manually create an instance of the class on your own__. |
146 |
| -
|
147 | 39 | ## Use Case
|
148 | 40 |
|
149 | 41 | Trying to get emoji support in your application in a way that is both compatible with a browser and
|
|
0 commit comments