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);
}
}
});
}
};
}
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);
}
}
}
};
}
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);
}
}
});
}
};
}
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;
}
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;
}
Aggregations