package com.rv.search.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.plugin.search.R;
import com.rv.search.bean.BeanTravelSearch;

/**
 * 周边游  adapter
 */
public class TravelSearchAdapter extends BaseQuickAdapter<BeanTravelSearch.DataBeanX.DataBean, BaseViewHolder> {
    public TravelSearchAdapter() {
        super(R.layout.rv_item_travel_search);
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanTravelSearch.DataBeanX.DataBean item) {
        GlideManager.getInstance(mContext).loadRoundImage(item.getCover(),  (ImageView)helper.getView(R.id.iv_goods),10);
         helper.setText(R.id.tv_name,item.getName());
        helper.setText(R.id.tv_price,String.format("￥%1$s%2$s",item.getPrice(),item.getUnit()));
    }

    public void addNewData(BeanTravelSearch bean) {
        mData.clear();
        addData(bean.getData().getData());
        notifyDataSetChanged();
    }
}
