Search in sources :

Example 1 with EaseEmojicon

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

Example 2 with EaseEmojicon

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);
    }
}
Also used : EmojiconPagerAdapter(com.hyphenate.easeui.adapter.EmojiconPagerAdapter) EaseEmojiconGroupEntity(com.hyphenate.easeui.domain.EaseEmojiconGroupEntity) EaseEmojicon(com.hyphenate.easeui.domain.EaseEmojicon) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 3 with EaseEmojicon

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;
}
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 4 with EaseEmojicon

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

Example 5 with EaseEmojicon

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();
        }
    });
}
Also used : EaseEmojiconMenuListener(com.hyphenate.easeui.widget.emojicon.EaseEmojiconMenuBase.EaseEmojiconMenuListener) EaseEmojicon(com.hyphenate.easeui.domain.EaseEmojicon) EaseChatPrimaryMenuListener(com.hyphenate.easeui.widget.EaseChatPrimaryMenuBase.EaseChatPrimaryMenuListener) View(android.view.View) MotionEvent(android.view.MotionEvent)

Aggregations

EaseEmojicon (com.hyphenate.easeui.domain.EaseEmojicon)7 View (android.view.View)4 MotionEvent (android.view.MotionEvent)2 AdapterView (android.widget.AdapterView)2 GridView (android.widget.GridView)2 Type (com.hyphenate.easeui.domain.EaseEmojicon.Type)2 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 EmojiconGridAdapter (com.hyphenate.easeui.adapter.EmojiconGridAdapter)1 EmojiconPagerAdapter (com.hyphenate.easeui.adapter.EmojiconPagerAdapter)1 EaseEmojiconGroupEntity (com.hyphenate.easeui.domain.EaseEmojiconGroupEntity)1 ChatInputMenuListener (com.hyphenate.easeui.widget.EaseChatInputMenu.ChatInputMenuListener)1 EaseChatPrimaryMenuListener (com.hyphenate.easeui.widget.EaseChatPrimaryMenuBase.EaseChatPrimaryMenuListener)1 EaseVoiceRecorderView (com.hyphenate.easeui.widget.EaseVoiceRecorderView)1 EaseVoiceRecorderCallback (com.hyphenate.easeui.widget.EaseVoiceRecorderView.EaseVoiceRecorderCallback)1 EaseEmojiconMenuListener (com.hyphenate.easeui.widget.emojicon.EaseEmojiconMenuBase.EaseEmojiconMenuListener)1 ArrayList (java.util.ArrayList)1