package com.sheep.gamegroup.view.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sheep.gamegroup.model.entity.GameInfoList;
import com.sheep.gamegroup.model.entity.TitleInfoList;
import com.sheep.gamegroup.util.ViewUtil;
import com.sheep.jiuyan.samllsheep.R;

import java.util.List;


/**
 * Created by realicing on 2018/11/1.
 * realicing@sina.com
 * 搜索游戏中的热门搜索与搜索历史
 */
public class AdpTitleInfoList extends BaseQuickAdapter<TitleInfoList, BaseViewHolder> {
    public AdpTitleInfoList(List<TitleInfoList> list) {
        super(R.layout.item_title_info_list, list);
    }

    @Override
    public void convert(BaseViewHolder viewHolder, final TitleInfoList itemList) {
        View item_title_info_list_top = viewHolder.itemView.findViewById(R.id.item_title_info_list_top);
        View item_title_info_list_bottom = viewHolder.itemView.findViewById(R.id.item_title_info_list_bottom);
        TextView item_title_info_list_tv = viewHolder.itemView.findViewById(R.id.item_title_info_list_tv);
        RecyclerView recyclerView = viewHolder.itemView.findViewById(R.id.item_title_info_list_rv);

        ViewUtil.setVisibility(item_title_info_list_top, itemList.isShowTopLine());
        ViewUtil.setVisibility(item_title_info_list_bottom, itemList.isShowBottomLine());
        ViewUtil.setText(item_title_info_list_tv, itemList.getName());

        recyclerView.setHasFixedSize(true);
        recyclerView.setNestedScrollingEnabled(false);
        recyclerView.setLayoutManager(itemList.getLayoutManager());
        recyclerView.setAdapter(itemList.getAdapter());
    }
}
