use of com.hyphenate.easeui.domain.EaseEmojicon in project SmartCampus by Vegen.
the class EmojiconGridAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
if (emojiconType == Type.BIG_EXPRESSION) {
convertView = View.inflate(getContext(), R.layout.ease_row_big_expression, null);
} else {
convertView = View.inflate(getContext(), R.layout.ease_row_expression, null);
}
}
ImageView imageView = (ImageView) convertView.findViewById(R.id.iv_expression);
TextView textView = (TextView) convertView.findViewById(R.id.tv_name);
EaseEmojicon emojicon = getItem(position);
if (textView != null && emojicon.getName() != null) {
textView.setText(emojicon.getName());
}
if (EaseSmileUtils.DELETE_KEY.equals(emojicon.getEmojiText())) {
imageView.setImageResource(R.drawable.ease_delete_expression);
} else {
if (emojicon.getIcon() != 0) {
imageView.setImageResource(emojicon.getIcon());
} else if (emojicon.getIconPath() != null) {
Glide.with(getContext()).load(emojicon.getIconPath()).placeholder(R.drawable.ease_default_expression).into(imageView);
}
}
return convertView;
}
use of com.hyphenate.easeui.domain.EaseEmojicon in project SmartCampus by Vegen.
the class EaseEmojiconPagerView method init.
public void init(List<EaseEmojiconGroupEntity> emojiconGroupList, int emijiconColumns, int bigEmojiconColumns) {
if (emojiconGroupList == null) {
throw new RuntimeException("emojiconGroupList is null");
}
this.groupEntities = emojiconGroupList;
this.emojiconColumns = emijiconColumns;
this.bigEmojiconColumns = bigEmojiconColumns;
viewpages = new ArrayList<View>();
for (int i = 0; i < groupEntities.size(); i++) {
EaseEmojiconGroupEntity group = groupEntities.get(i);
List<EaseEmojicon> groupEmojicons = group.getEmojiconList();
List<View> gridViews = getGroupGridViews(group);
if (i == 0) {
firstGroupPageSize = gridViews.size();
}
maxPageCount = Math.max(gridViews.size(), maxPageCount);
viewpages.addAll(gridViews);
}
pagerAdapter = new EmojiconPagerAdapter(viewpages);
setAdapter(pagerAdapter);
setOnPageChangeListener(new EmojiPagerChangeListener());
if (pagerViewListener != null) {
pagerViewListener.onPagerViewInited(maxPageCount, firstGroupPageSize);
}
}
use of com.hyphenate.easeui.domain.EaseEmojicon in project SmartCampus by Vegen.
the class EaseEmojiconPagerView method getGroupGridViews.
/**
* get emojicon group gridview list
* @param groupEntity
* @return
*/
public List<View> getGroupGridViews(EaseEmojiconGroupEntity groupEntity) {
List<EaseEmojicon> emojiconList = groupEntity.getEmojiconList();
int itemSize = emojiconColumns * emojiconRows - 1;
int totalSize = emojiconList.size();
Type emojiType = groupEntity.getType();
if (emojiType == Type.BIG_EXPRESSION) {
itemSize = bigEmojiconColumns * bigEmojiconRows;
}
int pageSize = totalSize % itemSize == 0 ? totalSize / itemSize : totalSize / itemSize + 1;
List<View> views = new ArrayList<View>();
for (int i = 0; i < pageSize; i++) {
View view = View.inflate(context, R.layout.ease_expression_gridview, null);
GridView gv = (GridView) view.findViewById(R.id.gridview);
if (emojiType == Type.BIG_EXPRESSION) {
gv.setNumColumns(bigEmojiconColumns);
} else {
gv.setNumColumns(emojiconColumns);
}
List<EaseEmojicon> list = new ArrayList<EaseEmojicon>();
if (i != pageSize - 1) {
list.addAll(emojiconList.subList(i * itemSize, (i + 1) * itemSize));
} else {
list.addAll(emojiconList.subList(i * itemSize, totalSize));
}
if (emojiType != Type.BIG_EXPRESSION) {
EaseEmojicon deleteIcon = new EaseEmojicon();
deleteIcon.setEmojiText(EaseSmileUtils.DELETE_KEY);
list.add(deleteIcon);
}
final EmojiconGridAdapter gridAdapter = new EmojiconGridAdapter(context, 1, list, emojiType);
gv.setAdapter(gridAdapter);
gv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
EaseEmojicon emojicon = gridAdapter.getItem(position);
if (pagerViewListener != null) {
String emojiText = emojicon.getEmojiText();
if (emojiText != null && emojiText.equals(EaseSmileUtils.DELETE_KEY)) {
pagerViewListener.onDeleteImageClicked();
} else {
pagerViewListener.onExpressionClicked(emojicon);
}
}
}
});
views.add(view);
}
return views;
}
use of com.hyphenate.easeui.domain.EaseEmojicon in project SmartCampus by Vegen.
the class EaseChatRowBigExpression method onSetUpView.
@Override
public void onSetUpView() {
String emojiconId = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null);
EaseEmojicon emojicon = null;
if (EaseUI.getInstance().getEmojiconInfoProvider() != null) {
emojicon = EaseUI.getInstance().getEmojiconInfoProvider().getEmojiconInfo(emojiconId);
}
if (emojicon != null) {
if (emojicon.getBigIcon() != 0) {
Glide.with(activity).load(emojicon.getBigIcon()).placeholder(R.drawable.ease_default_expression).into(imageView);
} else if (emojicon.getBigIconPath() != null) {
Glide.with(activity).load(emojicon.getBigIconPath()).placeholder(R.drawable.ease_default_expression).into(imageView);
} else {
imageView.setImageResource(R.drawable.ease_default_expression);
}
}
}
use of com.hyphenate.easeui.domain.EaseEmojicon in project SmartCampus by Vegen.
the class EaseChatInputMenu method processChatMenu.
protected void processChatMenu() {
// send message button
chatPrimaryMenu.setChatPrimaryMenuListener(new EaseChatPrimaryMenuListener() {
@Override
public void onSendBtnClicked(String content) {
if (listener != null)
listener.onSendMessage(content);
}
@Override
public void onToggleVoiceBtnClicked() {
hideExtendMenuContainer();
}
@Override
public void onToggleExtendClicked() {
toggleMore();
}
@Override
public void onToggleEmojiconClicked() {
toggleEmojicon();
}
@Override
public void onEditTextClicked() {
hideExtendMenuContainer();
}
@Override
public boolean onPressToSpeakBtnTouch(View v, MotionEvent event) {
if (listener != null) {
return listener.onPressToSpeakBtnTouch(v, event);
}
return false;
}
});
// emojicon menu
emojiconMenu.setEmojiconMenuListener(new EaseEmojiconMenuListener() {
@Override
public void onExpressionClicked(EaseEmojicon emojicon) {
if (emojicon.getType() != EaseEmojicon.Type.BIG_EXPRESSION) {
if (emojicon.getEmojiText() != null) {
chatPrimaryMenu.onEmojiconInputEvent(EaseSmileUtils.getSmiledText(context, emojicon.getEmojiText()));
}
} else {
if (listener != null) {
listener.onBigExpressionClicked(emojicon);
}
}
}
@Override
public void onDeleteImageClicked() {
chatPrimaryMenu.onEmojiconDeleteEvent();
}
});
}
Aggregations