Search in sources :

Example 1 with ImMsgBean

use of com.xhsemoticonskeyboard.common.data.ImMsgBean in project XhsEmoticonsKeyboard by w446108264.

the class QqActivity method initListView.

private void initListView() {
    chattingListAdapter = new QqChattingListAdapter(this);
    List<ImMsgBean> beanList = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
        ImMsgBean bean = new ImMsgBean();
        bean.setContent("Test:" + i);
        beanList.add(bean);
    }
    chattingListAdapter.addData(beanList);
    lvChat.setAdapter(chattingListAdapter);
    lvChat.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            switch(scrollState) {
                case SCROLL_STATE_FLING:
                    break;
                case SCROLL_STATE_IDLE:
                    break;
                case SCROLL_STATE_TOUCH_SCROLL:
                    ekBar.reset();
                    break;
            }
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        }
    });
}
Also used : ImMsgBean(com.xhsemoticonskeyboard.common.data.ImMsgBean) ArrayList(java.util.ArrayList) AbsListView(android.widget.AbsListView)

Example 2 with ImMsgBean

use of com.xhsemoticonskeyboard.common.data.ImMsgBean in project XhsEmoticonsKeyboard by w446108264.

the class SimpleChatOnCoordinatorLayoutActivity method OnSendBtnClick.

private void OnSendBtnClick(String msg) {
    if (!TextUtils.isEmpty(msg)) {
        ImMsgBean bean = new ImMsgBean();
        bean.setContent(msg);
        chattingListAdapter.addData(bean, true, false);
        scrollToBottom();
    }
}
Also used : ImMsgBean(com.xhsemoticonskeyboard.common.data.ImMsgBean)

Example 3 with ImMsgBean

use of com.xhsemoticonskeyboard.common.data.ImMsgBean in project XhsEmoticonsKeyboard by w446108264.

the class SimpleTranslucentChatActivity method OnSendBtnClick.

private void OnSendBtnClick(String msg) {
    if (!TextUtils.isEmpty(msg)) {
        ImMsgBean bean = new ImMsgBean();
        bean.setContent(msg);
        chattingListAdapter.addData(bean, true, false);
        scrollToBottom();
    }
}
Also used : ImMsgBean(com.xhsemoticonskeyboard.common.data.ImMsgBean)

Example 4 with ImMsgBean

use of com.xhsemoticonskeyboard.common.data.ImMsgBean in project XhsEmoticonsKeyboard by w446108264.

the class ChattingListAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final ImMsgBean bean = mData.get(position);
    int type = getItemViewType(position);
    View holderView = null;
    switch(type) {
        case VIEW_TYPE_LEFT_TEXT:
            ViewHolderLeftText holder;
            if (convertView == null) {
                holder = new ViewHolderLeftText();
                holderView = mInflater.inflate(R.layout.listitem_cha_left_text, null);
                holderView.setFocusable(true);
                holder.iv_avatar = (ImageView) holderView.findViewById(R.id.iv_avatar);
                holder.tv_content = (TextView) holderView.findViewById(R.id.tv_content);
                holderView.setTag(holder);
                convertView = holderView;
            } else {
                holder = (ViewHolderLeftText) convertView.getTag();
            }
            disPlayLeftTextView(position, convertView, holder, bean);
            break;
        case VIEW_TYPE_LEFT_IMAGE:
            ViewHolderLeftImage imageHolder;
            if (convertView == null) {
                imageHolder = new ViewHolderLeftImage();
                holderView = mInflater.inflate(R.layout.listitem_chat_left_image, null);
                holderView.setFocusable(true);
                imageHolder.iv_avatar = (ImageView) holderView.findViewById(R.id.iv_avatar);
                imageHolder.iv_image = (ImageView) holderView.findViewById(R.id.iv_image);
                holderView.setTag(imageHolder);
                convertView = holderView;
            } else {
                imageHolder = (ViewHolderLeftImage) convertView.getTag();
            }
            disPlayLeftImageView(position, convertView, imageHolder, bean);
            break;
        default:
            convertView = new View(mActivity);
            break;
    }
    return convertView;
}
Also used : ImMsgBean(com.xhsemoticonskeyboard.common.data.ImMsgBean) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 5 with ImMsgBean

use of com.xhsemoticonskeyboard.common.data.ImMsgBean in project XhsEmoticonsKeyboard by w446108264.

the class QqActivity method OnSendBtnClick.

private void OnSendBtnClick(String msg) {
    if (!TextUtils.isEmpty(msg)) {
        ImMsgBean bean = new ImMsgBean();
        bean.setContent(msg);
        chattingListAdapter.addData(bean, true, false);
        scrollToBottom();
    }
}
Also used : ImMsgBean(com.xhsemoticonskeyboard.common.data.ImMsgBean)

Aggregations

ImMsgBean (com.xhsemoticonskeyboard.common.data.ImMsgBean)11 AbsListView (android.widget.AbsListView)5 ArrayList (java.util.ArrayList)5 ChattingListAdapter (com.xhsemoticonskeyboard.common.adapter.ChattingListAdapter)4 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1