image.png

    1. implementation 'me.luzhuo.java.android:lib_common_ui:1.0.6-SNAPSHOT'
    2. implementation 'me.luzhuo.java.android:emoji:1.0.0-SNAPSHOT'
    3. implementation project(path: ':emoji_chongjia')
    4. implementation 'androidx.appcompat:appcompat:1.2.0'
    5. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    6. implementation 'me.luzhuo.android:lib_core:2.0.23-SNAPSHOT'

    Application

    1. public class App extends Application {
    2. @Override
    3. public void onCreate() {
    4. super.onCreate();
    5. EmojiManager.getInstance()
    6. .addFilter(new EmojiFilter())
    7. .addFilter(new HashMapEmoticonFilter(ChongjiaEmoticons.ChongjiaHashMap))
    8. .addFilter(new HashMapAutoEmoticonFilter(MyEmoticons.MyEmojiHashMap));
    9. }
    10. }

    使用

    1. EmojiManager manager = EmojiManager.getInstance();
    2. final EditText tv1 = findViewById(R.id.tv1);
    3. TextView tv2 = findViewById(R.id.tv2);
    4. TextView tv3 = findViewById(R.id.tv3);
    5. tv1.addTextChangedListener(new TextWatcher() {
    6. @Override
    7. public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
    8. @Override
    9. public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
    10. EmojiManager.getInstance().EditTextFilter(tv1, charSequence, start, before, count);
    11. }
    12. @Override
    13. public void afterTextChanged(Editable s) { }
    14. });
    15. manager.TextViewFilter(tv2, "牛逼哟[偷笑]牛逼哟");
    16. manager.TextViewFilter(tv3, "牛逼哟[广告]牛逼哟[默认地址]牛逼哟");