package com.rv.home.rv.module.ui.main.home.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ruiwenliu.wrapper.util.BaseGlideHolder;
import com.rv.home.R;
import com.rv.home.R2;
import com.rv.home.rv.module.ui.main.home.bean.CarTypeListBean;
import com.rv.home.rv.module.ui.main.home.bean.ShopListBean;

/**
 * Created :Auser
 * Date: 2019/5/16.
 * Desc:租车列表适配器
 * https://blog.csdn.net/anita9999/article/details/82346552
 */

public class CarRentalListAdapter extends BaseQuickAdapter<CarTypeListBean.DataBeanX.DataBean,BaseGlideHolder>{
    public CarRentalListAdapter() {
        super(R.layout.rv_item_car_rental_list);
    }

    @Override
    protected void convert(BaseGlideHolder helper, CarTypeListBean.DataBeanX.DataBean item) {
        if (item.getVehicleModel() !=null){
            helper.setText(R.id.tv_name,item.getVehicleModel().getName());
            helper.setText(R.id.tv_context,item.getVehicleModel().getKeyword());
            helper.setText(R.id.tv_point,String.valueOf(item.getVehicleModel().getPoint()));
            helper.loadImage(mContext,item.getVehicleModel().getIcon(), (ImageView) helper.getView(R.id.iv_goods));
//        helper.setText(R.id.tv_name,item);
            helper.setText(R.id.tv_price,String.format("¥%1$s%2$s",item.getVehicleModel().getPrice(),mContext.getString(R.string.rv_day)));
        }

        helper.setText(R.id.tv_address,item.getCompany().getName());

        double instance=item.getDistance()/1000;
        helper.setText(R.id.tv_km,String.format("%1$s%2$.3f%3$s",mContext.getString(R.string.rv_km_you),instance,mContext.getString(R.string.rv_km)));


    }
}
