Search in sources :

Example 1 with EmoticonEntity

use of sj.keyboard.data.EmoticonEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method getCommonEmoticonDisplayListener.

public static EmoticonDisplayListener<Object> getCommonEmoticonDisplayListener(final EmoticonClickListener onEmoticonClickListener, final int type) {
    return new EmoticonDisplayListener<Object>() {

        @Override
        public void onBindView(int position, ViewGroup parent, EmoticonsAdapter.ViewHolder viewHolder, Object object, final boolean isDelBtn) {
            final EmoticonEntity emoticonEntity = (EmoticonEntity) object;
            if (emoticonEntity == null && !isDelBtn) {
                return;
            }
            viewHolder.ly_root.setBackgroundResource(com.keyboard.view.R.drawable.bg_emoticon);
            if (isDelBtn) {
                viewHolder.iv_emoticon.setImageResource(R.mipmap.icon_del);
            } else {
                try {
                    ImageLoader.getInstance(viewHolder.iv_emoticon.getContext()).displayImage(emoticonEntity.getIconUri(), viewHolder.iv_emoticon);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            viewHolder.rootView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (onEmoticonClickListener != null) {
                        onEmoticonClickListener.onEmoticonClick(emoticonEntity, type, isDelBtn);
                    }
                }
            });
        }
    };
}
Also used : ViewGroup(android.view.ViewGroup) EmoticonEntity(sj.keyboard.data.EmoticonEntity) EmoticonDisplayListener(sj.keyboard.interfaces.EmoticonDisplayListener) IOException(java.io.IOException) View(android.view.View) TextView(android.widget.TextView) SimpleAppsGridView(com.xhsemoticonskeyboard.common.widget.SimpleAppsGridView) EmoticonPageView(sj.keyboard.widget.EmoticonPageView)

Example 2 with EmoticonEntity

use of sj.keyboard.data.EmoticonEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method getCommonEmoticonClickListener.

public static EmoticonClickListener getCommonEmoticonClickListener(final EditText editText) {
    return new EmoticonClickListener() {

        @Override
        public void onEmoticonClick(Object o, int actionType, boolean isDelBtn) {
            if (isDelBtn) {
                SimpleCommonUtils.delClick(editText);
            } else {
                if (o == null) {
                    return;
                }
                if (actionType == Constants.EMOTICON_CLICK_TEXT) {
                    String content = null;
                    if (o instanceof EmojiBean) {
                        content = ((EmojiBean) o).emoji;
                    } else if (o instanceof EmoticonEntity) {
                        content = ((EmoticonEntity) o).getContent();
                    }
                    if (TextUtils.isEmpty(content)) {
                        return;
                    }
                    int index = editText.getSelectionStart();
                    Editable editable = editText.getText();
                    editable.insert(index, content);
                }
            }
        }
    };
}
Also used : EmoticonClickListener(sj.keyboard.interfaces.EmoticonClickListener) EmojiBean(com.sj.emoji.EmojiBean) EmoticonEntity(sj.keyboard.data.EmoticonEntity) Editable(android.text.Editable)

Example 3 with EmoticonEntity

use of sj.keyboard.data.EmoticonEntity in project XhsEmoticonsKeyboard by w446108264.

the class QqUtils method getEmoticonDisplayListener.

public static EmoticonDisplayListener<Object> getEmoticonDisplayListener(final EmoticonClickListener emoticonClickListener) {
    return new EmoticonDisplayListener<Object>() {

        @Override
        public void onBindView(int position, ViewGroup parent, EmoticonsAdapter.ViewHolder viewHolder, Object object, final boolean isDelBtn) {
            final EmoticonEntity emoticonEntity = (EmoticonEntity) object;
            if (emoticonEntity == null && !isDelBtn) {
                return;
            }
            viewHolder.ly_root.setBackgroundResource(com.keyboard.view.R.drawable.bg_emoticon);
            if (isDelBtn) {
                viewHolder.iv_emoticon.setImageResource(R.mipmap.icon_del);
            } else {
                try {
                    ImageLoader.getInstance(viewHolder.iv_emoticon.getContext()).displayImage(emoticonEntity.getIconUri(), viewHolder.iv_emoticon);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            viewHolder.rootView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (emoticonClickListener != null) {
                        emoticonClickListener.onEmoticonClick(emoticonEntity, Constants.EMOTICON_CLICK_TEXT, isDelBtn);
                    }
                }
            });
        }
    };
}
Also used : ViewGroup(android.view.ViewGroup) EmoticonEntity(sj.keyboard.data.EmoticonEntity) EmoticonDisplayListener(sj.keyboard.interfaces.EmoticonDisplayListener) IOException(java.io.IOException) View(android.view.View) TextView(android.widget.TextView) EmoticonPageView(sj.keyboard.widget.EmoticonPageView)

Example 4 with EmoticonEntity

use of sj.keyboard.data.EmoticonEntity in project XhsEmoticonsKeyboard by w446108264.

the class ParseDataUtils method ParseQqData.

public static ArrayList<EmoticonEntity> ParseQqData(HashMap<String, Integer> data) {
    Iterator iter = data.entrySet().iterator();
    if (!iter.hasNext()) {
        return null;
    }
    ArrayList<EmoticonEntity> emojis = new ArrayList<>();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        Object key = entry.getKey();
        Object val = entry.getValue();
        EmoticonEntity entity = new EmoticonEntity();
        entity.setContent((String) key);
        entity.setIconUri("" + val);
        emojis.add(entity);
    }
    return emojis;
}
Also used : Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) EmoticonEntity(sj.keyboard.data.EmoticonEntity) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with EmoticonEntity

use of sj.keyboard.data.EmoticonEntity in project XhsEmoticonsKeyboard by w446108264.

the class ParseDataUtils method parseKaomojiData.

public static ArrayList<EmoticonEntity> parseKaomojiData(Context context) {
    ArrayList<EmoticonEntity> textEmotionArray = new ArrayList<>();
    try {
        InputStreamReader inputStreamReader = new InputStreamReader(context.getAssets().open("kaomoji"));
        BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            EmoticonEntity bean = new EmoticonEntity(line.trim());
            textEmotionArray.add(bean);
        }
        return textEmotionArray;
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : InputStreamReader(java.io.InputStreamReader) ArrayList(java.util.ArrayList) EmoticonEntity(sj.keyboard.data.EmoticonEntity) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException)

Aggregations

EmoticonEntity (sj.keyboard.data.EmoticonEntity)13 IOException (java.io.IOException)7 View (android.view.View)5 TextView (android.widget.TextView)4 ArrayList (java.util.ArrayList)4 EmoticonPageSetEntity (sj.keyboard.data.EmoticonPageSetEntity)3 Editable (android.text.Editable)2 SpannableStringBuilder (android.text.SpannableStringBuilder)2 ViewGroup (android.view.ViewGroup)2 EmojiBean (com.sj.emoji.EmojiBean)2 EmoticonClickListener (sj.keyboard.interfaces.EmoticonClickListener)2 EmoticonDisplayListener (sj.keyboard.interfaces.EmoticonDisplayListener)2 EmoticonPageView (sj.keyboard.widget.EmoticonPageView)2 ImageView (android.widget.ImageView)1 BigEmoticonsAdapter (com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAdapter)1 BigEmoticonsAndTitleAdapter (com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAndTitleAdapter)1 SimpleAppsGridView (com.xhsemoticonskeyboard.common.widget.SimpleAppsGridView)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 HashMap (java.util.HashMap)1