Kotlin Multi-platform Emoji Support Library.
Emoji(
unicodeString = "U+1F600",
character = "😀",
name = "grinning face",
aliases = listOf("grinning_face", "grin_face", "grin face"),
category = "Smileys & Emotion",
group = "face-smiling",
iconUri = null
)
Emojis can be retrieved from a EmojiRepository
instance:
val emojiByName = emojiRepository.getByName("grinning face")
val emojiByAlias = emojiRepository.getByAlias(":grinning_face:")
val allEmojis = emojiRepository.getAll()
The EmojiRepository
interface is in the emoji-core
module but there are different implementations in
the emoji-repo-map
and emoji-repo-sqlite
modules. Note that the emoji-repo-sqlite
module uses
the sqldelight library and requires a SqlDriver
to obtain an instance of
the SqliteEmojiRepository
.
emoji-repo-map
:
val repo = KotlinMapEmojiRepository()
emoji-repo-sqlite
:
val database = EmojiDatabase(sqldriver)
val repo = SqliteEmojiRepository(database)
Before the EmojiRepository
implementation class is used for the first time, it has to be initialized by calling
the init()
function. This loads the emoji data set. Note that the init()
function is only on the implementation
classes and not on the EmojiRepository
interface.
repository.init()
It may be useful to have the Emojis grouped by their category
and/or group
properties. There are convenience
functions to achieve this.
repository.getAll().categorize() // List<EmojiCategory>
repository.getAll().group() // List<EmojiGroup>
The library is provided through Repsy.io. Checkout
the releases page to get the latest version.
repositories {
maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") }
}
implementation("com.chrynan.emoji:emoji-core:$VERSION")
implementation("com.chrynan.emoji:emoji-repo-map:$VERSION")
implementation("com.chrynan.emoji:emoji-repo-sqlite:$VERSION")
implementation("com.chrynan.emoji:emoji-ui-compose:$VERSION")
More detailed documentation is available in the docs folder. The entry point to the documentation can be found here.
Copyright 2020 chRyNaN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.