implementation 'me.luzhuo.java.android:lib_common_ui:1.0.6-SNAPSHOT'
implementation 'me.luzhuo.java.android:emoji:1.0.0-SNAPSHOT'
implementation project(path: ':emoji_chongjia')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'me.luzhuo.android:lib_core:2.0.23-SNAPSHOT'
Application
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
EmojiManager.getInstance()
.addFilter(new EmojiFilter())
.addFilter(new HashMapEmoticonFilter(ChongjiaEmoticons.ChongjiaHashMap))
.addFilter(new HashMapAutoEmoticonFilter(MyEmoticons.MyEmojiHashMap));
}
}
使用
EmojiManager manager = EmojiManager.getInstance();
final EditText tv1 = findViewById(R.id.tv1);
TextView tv2 = findViewById(R.id.tv2);
TextView tv3 = findViewById(R.id.tv3);
tv1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
EmojiManager.getInstance().EditTextFilter(tv1, charSequence, start, before, count);
}
@Override
public void afterTextChanged(Editable s) { }
});
manager.TextViewFilter(tv2, "牛逼哟[偷笑]牛逼哟");
manager.TextViewFilter(tv3, "牛逼哟[广告]牛逼哟[默认地址]牛逼哟");