MsgViewHolderChatTip.java 1.42 KB
Newer Older
konghaorui committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
package com.yidianling.im.session.viewholder;

import android.widget.TextView;

import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachChatTipMsg;
import com.ydl.ydlcommon.utils.Utils;

/**
 * Created by harvie on 2015/11/25.
 * 自定义样式提醒消息ViewHolder 短时间内私聊次数过多给你警示
 */
public class MsgViewHolderChatTip extends MsgViewHolderBase {

    protected TextView notificationTextView;

    public MsgViewHolderChatTip(BaseMultiItemFetchLoadAdapter adapter) {
        super(adapter);
    }

    @Override
    protected int getContentResId() {
konghaorui committed
25
        return R.layout.im_ui_message_chat_tip;
konghaorui committed
26 27 28 29 30 31 32 33 34 35 36 37
    }

    @Override
    protected void inflateContentView() {
        notificationTextView = (TextView) view.findViewById(R.id.message_receive_tv);
    }

    @Override
    protected void bindContentView() {
        CustomAttachChatTipMsg customAttachTipMsg = (CustomAttachChatTipMsg) message.getAttachment();
        String content = customAttachTipMsg.getFrom_content();
        if (content!=null){
konghaorui committed
38
            notificationTextView.setText(Utils.textValueOfStart(R.drawable.im_nim_ic_failed,content));
konghaorui committed
39 40 41 42 43 44 45 46 47 48
        }

        hideItemBg();
    }

    @Override
    protected boolean isMiddleItem() {
        return true;
    }
}