package com.sheep.gamegroup.view.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sheep.gamegroup.util.ActivityManager;
import com.sheep.gamegroup.util.CommonUtil;
import com.sheep.gamegroup.util.ViewUtil;
import com.sheep.jiuyan.samllsheep.R;
import com.sheep.jiuyan.samllsheep.SheepApp;
import com.sheep.jiuyan.samllsheep.bean.UserCenterModule;

import java.util.List;

/**
 * Created by realicing on 2018/11/14.
 * realicing@sina.com
 * 用户中心模块 adapter
 */
public class AdpUserCenterModule extends BaseQuickAdapter<UserCenterModule, BaseViewHolder> {

    public AdpUserCenterModule(@Nullable List<UserCenterModule> data) {
        super(R.layout.item_my_list_but, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final UserCenterModule item) {
        helper.setText(R.id.my_item_text, item.getTitle());
        ViewUtil.updateTag((TextView) helper.getView(R.id.my_item_tag), item);
        Glide.with(SheepApp.getInstance()).load(item.getIcon()).into((ImageView) helper.getView(R.id.my_item_img));
        helper.getView(R.id.my_item_but).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CommonUtil.getInstance().goNative(ActivityManager.getInstance().currentActivity(), item, "个人中心");
            }
        });
    }
}
