Emoji

A simple library to add Emoji support to your Android Application

License

License

GroupId

GroupId

com.vanniktech
ArtifactId

ArtifactId

emoji-one
Last Version

Last Version

0.6.0
Release Date

Release Date

Type

Type

aar
Description

Description

Emoji
A simple library to add Emoji support to your Android Application
Project URL

Project URL

https://github.com/vanniktech/Emoji
Source Code Management

Source Code Management

https://github.com/vanniktech/Emoji

Download emoji-one

How to add to project

<!-- https://jarcasting.com/artifacts/com.vanniktech/emoji-one/ -->
<dependency>
    <groupId>com.vanniktech</groupId>
    <artifactId>emoji-one</artifactId>
    <version>0.6.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.vanniktech/emoji-one/
implementation 'com.vanniktech:emoji-one:0.6.0'
// https://jarcasting.com/artifacts/com.vanniktech/emoji-one/
implementation ("com.vanniktech:emoji-one:0.6.0")
'com.vanniktech:emoji-one:aar:0.6.0'
<dependency org="com.vanniktech" name="emoji-one" rev="0.6.0">
  <artifact name="emoji-one" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.vanniktech', module='emoji-one', version='0.6.0')
)
libraryDependencies += "com.vanniktech" % "emoji-one" % "0.6.0"
[com.vanniktech/emoji-one "0.6.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.vanniktech : emoji jar 0.6.0

Project Modules

There are no modules declared in this project.

Emoji

A library to add Emoji support to your Android app. Emojis can be picked in a PopupWindow. In order to edit and display text with Emojis this library provides public APIs:

There's also a EmojiLayoutFactory, which can be used to get automatic Emoji support when using normal Android Views such as TextView, Checkbox, etc.

Material Design Library bindings can be included via:

implementation 'com.vanniktech:emoji-material:0.7.0'

There's also a MaterialEmojiLayoutFactory, which can be used to get automatic Emoji support.

The library has 4 different providers to choose from (iOS, Google, Facebook & Twitter).

iOS Emojis

Normal KeyboardEmoji KeyboardRecent Emojis

For getting the above iOS Emojis simply add the dependency and code below.

implementation 'com.vanniktech:emoji-ios:0.7.0'

And install the provider in your application class.

EmojiManager.install(new IosEmojiProvider());

Google

Normal KeyboardEmoji KeyboardRecent Emojis

For getting the above Google Emojis simply add the dependency and code below.

implementation 'com.vanniktech:emoji-google:0.7.0'

And install the provider in your application class.

EmojiManager.install(new GoogleEmojiProvider());

Facebook

Normal KeyboardEmoji KeyboardRecent Emojis

For getting the above Facebook Emojis simply add the dependency and code below.

implementation 'com.vanniktech:emoji-facebook:0.7.0'

And install the provider in your application class.

EmojiManager.install(new GoogleEmojiProvider());

Twitter

Normal KeyboardEmoji KeyboardRecent Emojis

For getting the above Twitter Emojis simply add the dependency and code below.

implementation 'com.vanniktech:emoji-twitter:0.7.0'

And install the provider in your application class.

EmojiManager.install(new TwitterEmojiProvider());

Custom Emojis

If you want to display your own Emojis you can create your own implementation of EmojiProvider and pass it to EmojiManager.install.

All of the core API lays in emoji, which is being pulled in automatically by the provided implementations:

implementation 'com.vanniktech:emoji:0.7.0'

Set up

Inserting Emojis

Declare your EmojiEditText in your layout xml file.

<com.vanniktech.emoji.EmojiEditText
  android:id="@+id/emojiEditText"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:imeOptions="actionSend"
  android:inputType="textCapSentences|textMultiLine"
  android:maxLines="3"/>

To open the EmojiPopup execute the code below:

final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(rootView).build(emojiEditText);
emojiPopup.toggle(); // Toggles visibility of the Popup.
emojiPopup.dismiss(); // Dismisses the Popup.
emojiPopup.isShowing(); // Returns true when Popup is showing.

The rootView is the rootView of your layout xml file which will be used for calculating the height of the keyboard. emojiEditText is the EmojiEditText that you declared in your layout xml file.

Displaying Emojis

<com.vanniktech.emoji.EmojiTextView
  android:id="@+id/emojiTextView"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>

Just use the EmojiTextView and call setText with the String that contains Unicode encoded Emojis. To change the size of the displayed Emojis use the lineHeight property from TextView.

EmojiPopup Listeners

The EmojiPopup builder allows you to declare several listeners.

setOnSoftKeyboardCloseListener(OnSoftKeyboardCloseListener listener);
setOnEmojiClickListener(OnEmojiClickListener listener);
setOnSoftKeyboardOpenListener(OnSoftKeyboardOpenListener listener);
setOnEmojiPopupShownListener(OnEmojiPopupShownListener listener);
setOnEmojiPopupDismissListener(OnEmojiPopupDismissListener listener);
setOnEmojiBackspaceClickListener(OnEmojiBackspaceClickListener listener);

EmojiPopup Configuration

Custom Recent Emoji implementation

You can pass your own implementation of the recent Emojis. Implement the RecentEmoji interface and pass it when you're building the EmojiPopup:

setRecentEmoji(yourClassThatImplementsRecentEmoji)

If no instance or a null instance is set the default implementation will be used.

Custom Variant Emoji implementation

You can pass your own implementation of the variant Emojis. Implement the VariantEmoji interface and pass it when you're building the EmojiPopup:

setVariantEmoji(yourClassThatImplementsVariantEmoji)

If no instance or a null instance is set the default implementation will be used.

Animations

Custom keyboard enter and exit animations

You can pass your own animation style for enter and exit transitions of the Emoji keyboard while you're building the EmojiPopup:

setKeyboardAnimationStyle(R.style.emoji_fade_animation_style);

If no style is set the keyboard will appear and exit as a regular PopupWindow. This library currently ships with two animation styles as an example:

  • R.style.emoji_slide_animation_style
  • R.style.emoji_fade_animation_style

Custom page transformers

You can pass your own Page Transformer for the Emoji keyboard View Pager while you're building the EmojiPopup:

setPageTransformer(new MagicTransformer());

If no transformer is set ViewPager will behave as its usual self. Please do note that this library currently does not ship any example Page Transformers.

Other goodies

  • MaximalNumberOfEmojisInputFilter can be used to limit the number of Emojis one can type into an EditText
  • OnlyEmojisInputFilter can be used to limit the input of an EditText to emoji only
  • SingleEmojiTrait can be used to force a single emoji which can be replaced by a new one
  • EmojiEditText#disableKeyboardInput() to disable normal keyboard input. To undo call #enableKeyboardInput()

Snapshots

This library is also distributed as a SNAPSHOT if you like to check out the latest features.

Note: The API is not stable and may change and break your code at any time if you use a SNAPSHOT.

Add this to your repositories:

maven { url "https://oss.sonatype.org/content/repositories/snapshots" }

And one of these to your dependencies:

implementation 'com.vanniktech:emoji:0.8.0-SNAPSHOT'
implementation 'com.vanniktech:emoji-ios:0.8.0-SNAPSHOT'
implementation 'com.vanniktech:emoji-google:0.8.0-SNAPSHOT'
implementation 'com.vanniktech:emoji-twitter:0.8.0-SNAPSHOT'
implementation 'com.vanniktech:emoji-facebook:0.8.0-SNAPSHOT'
implementation 'com.vanniktech:emoji-material:0.8.0-SNAPSHOT'

Proguard

No configuration needed.

License

Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors

Licensed under the Apache License, Version 2.0

Versions

Version
0.6.0
0.5.1
0.5.0
0.4.0