MsgViewHolderPhoneCallRedPacket.java 2.07 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 25 26 27 28 29 30 31 32 33 34 35
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.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallRedPacket;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;

/**
 * @author jiucheng
 * @描述: 倾述完成后,评价领取红包
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2018/12/25
 */
public class MsgViewHolderPhoneCallRedPacket extends MsgViewHolderBase {

    private TextView titleTv;
    private TextView moneyTv;
    private TextView typeTv;
    private String url;
    private String title;
    private String money;
    private String type;

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

    @Override
    protected int getContentResId() {
konghaorui committed
36
        return R.layout.im_ui_message_phone_call_red_packet;
konghaorui committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    }

    @Override
    protected void inflateContentView() {
        titleTv = view.findViewById(R.id.tv_title);
        moneyTv = view.findViewById(R.id.tv_money);
        typeTv = view.findViewById(R.id.tv_type);
    }

    @Override
    protected void bindContentView() {
        MsgAttachment attachment = message.getAttachment();
        if (attachment instanceof CustomAttachmentPhoneCallRedPacket) {
            url = ((CustomAttachmentPhoneCallRedPacket) attachment).getUrl();
            money = ((CustomAttachmentPhoneCallRedPacket) attachment).getMoeny();
            title = ((CustomAttachmentPhoneCallRedPacket) attachment).getTitle();
            type = ((CustomAttachmentPhoneCallRedPacket) attachment).getTypeRedPacket();
            titleTv.setText(title);
            moneyTv.setText(money);
            typeTv.setText(type);
        }
    }

    @Override
    protected void onItemClick() {
        NewH5Activity.start(context, new H5Params(url, "评价"));
    }
}