A nice Android bottom sheet dialog populated with AndroidX EmojiCompat supported emojis.
private fun initializeEmojiCategoriesPreferred() {
emojiItemViewList = EmojiCategoryTransformer().transform(initializeEmojiCategoryList())
}
private fun initializeEmojiCategoryList(): List<Category> {
return listOf(
ActivitiesCategory(getString(R.string.activitiesCategoryTitle)),
AnimalsNatureCategory(getString(R.string.animalsAndNatureTitle)),
FoodDrinkCategory(getString(R.string.foodAndDrinkTitle)),
FlagsCategory(getString(R.string.flagsTitle)),
ObjectsCategory(getString(R.string.objectsTitle)),
SmileysPeopleCategory(getString(R.string.smileysAndPeopleTitle)),
SymbolsCategory(getString(R.string.symbolsTitle)),
TravelPlacesCategory(getString(R.string.travelAndPlacesTitle))
)
}
private fun showEmojiDialog() {
EmojiPickerDialog.Builder(this@MainActivity, emojiItemViewList)
.dismissWithAnimation(true)
.title(getString(R.string.emojiDialogTitle))
.cancelable(true)
.listener(object : EmojiClickListener {
override fun emojiClicked(unicode: EmojiItemView) {
selectedEmoji.text = unicode.value
selectedEmojiName.text = unicode.name
}
}).build().show()
}
In version 2.0.0
we migrated to Emoji2.
This results in the removal of:
EmojiCompatUtils
EmojInitListener
EmojiValues
which was mostly used internally.
Initialization now happens internally via the Emoji2. If you still need an initialization listener you should use the official API as described here. The whole document Support modern emoji - Android Developers provides further details.
The same document will help you if you rely on AppCompat version lower than 1.4.0-alpha01
or on the Emoji
library itself which provides these custom views for compatibility.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
The project uses gradle-maven-publish-plugin to publish artifacts to maven central.
To upload archives use the command (after having put the appropriate credentials in gradle properties or env variables):
./gradlew clean build emojiBottomSheetDialog:publish --no-daemon --no-parallel