MsgViewHolderCustomTip.java 1.28 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
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.CustomAttachTipMsg;

/**
 * Created by harvie on 2015/11/25.
 * 自定义样式提醒消息ViewHolder
 */
public class MsgViewHolderCustomTip extends MsgViewHolderBase {

    protected TextView notificationTextView;

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

    @Override
    protected int getContentResId() {
konghaorui committed
24
        return R.layout.im_ui_message_custom_tip;
konghaorui committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    }

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

    @Override
    protected void bindContentView() {
        CustomAttachTipMsg customAttachTipMsg = (CustomAttachTipMsg) message.getAttachment();
        String content = customAttachTipMsg.getFrom_content();
        if (content!=null){
            notificationTextView.setText(content);
        }

        hideItemBg();
    }

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