Library gif emoji like skype, messenger, wechat, whatapp, snapchat, facebook, zalo
![](/store/GIF.gif)
- Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Step 2. Add the dependency
dependencies {
compile 'com.github.hoanganhtuan95ptit:GifEmoticon:1.0.2'
}
<com.hoanganhtuan95ptit.emoticon.EmoticonTextView
android:id="@+id/tv_infor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:emoticonSize="30sp"
app:emoticonSchedule="40"/>
attr |
description |
emoticonSize |
the size of the emoticon, default textSize |
emoticonSchedule |
Emoticon refresh cycle, default 40 |
How to customize the EmoticonTextView
- Customize EmoticonProvider
public interface EmoticonProvider {
HashMap<String, Integer> getEmoticons();
}
public class GifEmoticonProvider implements EmoticonProvider {
static final HashMap<String, Integer> EMOTICONS = new HashMap<>();
static {
EMOTICONS.put("(giggle)", R.drawable.giggle);
EMOTICONS.put("(monkey)", R.drawable.monkey);
EMOTICONS.put(":)", R.drawable.emoji_1);
...
}
private static GifEmoticonProvider exampleEmoticonProvider;
public static GifEmoticonProvider create() {
if (exampleEmoticonProvider == null) {
exampleEmoticonProvider = new GifEmoticonProvider();
}
return exampleEmoticonProvider;
}
private GifEmoticonProvider() {
}
@Override
public HashMap<String, Integer> getEmoticons() {
return EMOTICONS;
}
}
emoticonTextView.setEmoticonProvider(GifEmoticonProvider.create());
emoticonTextView.setTextEmoticon(message.getInfo());