Search in sources :

Example 1 with Type

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;
}
Also used : EmojiconGridAdapter(com.hyphenate.easeui.adapter.EmojiconGridAdapter) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ArrayList(java.util.ArrayList) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView) Type(com.hyphenate.easeui.domain.EaseEmojicon.Type) EaseEmojicon(com.hyphenate.easeui.domain.EaseEmojicon) GridView(android.widget.GridView)

Example 2 with Type

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;
}
Also used : Type(com.hyphenate.easeui.domain.EaseEmojicon.Type) EaseEmojicon(com.hyphenate.easeui.domain.EaseEmojicon)

Aggregations

EaseEmojicon (com.hyphenate.easeui.domain.EaseEmojicon)2 Type (com.hyphenate.easeui.domain.EaseEmojicon.Type)2 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 GridView (android.widget.GridView)1 EmojiconGridAdapter (com.hyphenate.easeui.adapter.EmojiconGridAdapter)1 ArrayList (java.util.ArrayList)1