use of com.hyphenate.easeui.domain.EaseEmojicon.Type 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.Type in project SmartCampus by Vegen.
the class EaseEmojiconPagerView method getPageSize.
/**
* get size of pages
* @param emojiconList
* @return
*/
private int getPageSize(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;
return pageSize;
}
Aggregations