package com.sheep.gamegroup.view.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.sheep.gamegroup.model.entity.MessageReplyDetailEntity;
import com.sheep.gamegroup.util.GlideImageLoader;
import com.sheep.gamegroup.util.TimeUtil;
import com.sheep.jiuyan.samllsheep.R;

/**
 * created on：2018/8/28 on 17:26
 * created by: YSL
 * 描述:消息互动中 点击一条用户反馈后进入的消息列表
 */
public class AdpMsgUserFeedBack extends RecyclerView.Adapter<AdpMsgUserFeedBack.MyHolder> {
    private Context mContext;
    private MessageReplyDetailEntity entity;

    public AdpMsgUserFeedBack(Context mContext, MessageReplyDetailEntity entity) {
        this.mContext = mContext;
        this.entity = entity;
    }

    @NonNull
    @Override
    public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view;
        view = LayoutInflater.from(mContext).inflate(R.layout.adapter_message_interaction, null);
        return new MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull MyHolder viewHolder, int i) {
        viewHolder.tvPeople.setText("官方回复");
        viewHolder.tvTime.setText(TimeUtil.TimeStamp2Date(entity.getUser_create_time(), "MM-dd HH:mm"));
        viewHolder.tvContent.setText(entity.getContent());


    }

    @Override
    public int getItemCount() {
        return entity == null ? 0 : 1;
    }

    class MyHolder extends RecyclerView.ViewHolder {
        private TextView tvPeople;//标题
        private TextView tvTime;//谁的消息
        private TextView tvContent;//每条消息的内容，这里最多只显示一行

        public MyHolder(View view) {
            super(view);
            tvPeople = view.findViewById(R.id.tv_people);
            tvTime = view.findViewById(R.id.tv_time);
            tvContent = view.findViewById(R.id.tv_content);
        }
    }
}
