MsgViewHolderModifyTime.java 1.91 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
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.CustomAttachModifyTime;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/04/04
 */

public class MsgViewHolderModifyTime extends MsgViewHolderBase {

    private String userUrl;
    private int dsmId;
    private String title;

    private TextView tvTitle;

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

    @Override
    protected int getContentResId() {
        if (isReceivedMessage()) {
konghaorui committed
34
            return R.layout.im_ui_message_modify_time_rec;
konghaorui committed
35
        }
konghaorui committed
36
        return R.layout.im_ui_message_modify_time;
konghaorui committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
    }

    @Override
    protected void inflateContentView() {
        tvTitle = view.findViewById(R.id.tv_title);
    }

    @Override
    protected void bindContentView() {
        MsgAttachment attachment = message.getAttachment();
        if (attachment instanceof CustomAttachModifyTime) {
            userUrl = ((CustomAttachModifyTime) attachment).getUserUrl();
            dsmId = ((CustomAttachModifyTime) attachment).getDsmId();
            title = ((CustomAttachModifyTime) attachment).getTitle();
            tvTitle.setText(title);
        }

        hideItemBg();
    }

    @Override
    protected void onItemClick() {
59 60 61 62 63 64 65
        String url;
        if (userUrl.endsWith("?")) {
            url = userUrl + "dsmId=" + dsmId;
        } else {
            url = userUrl + "&dsmId=" + dsmId;
        }
        NewH5Activity.start(context, new H5Params(url, "预约时间修改"));
konghaorui committed
66 67
    }
}