package com.mints.goodmoney.ui.adapter

import android.content.Context
import android.graphics.Color
import android.view.View
import android.widget.TextView
import com.mints.goodmoney.R
import com.mints.goodmoney.mvp.model.FriendsTaskBean

class BannerTaskAdapter(context: Context) : BannerBaseAdapter<FriendsTaskBean.ChallengeBean.ListBean>(context) {

    private val mContext: Context = context

    override fun getLayoutResID() = R.layout.item_bv_friends_task

    override fun convert(convertView: View, data: FriendsTaskBean.ChallengeBean.ListBean) {
        convertView.findViewById<TextView>(R.id.item_bv_friends_task_title).text = data.title
        convertView.findViewById<TextView>(R.id.item_bv_friends_task_info).text = data.remarks
        convertView.findViewById<TextView>(R.id.item_bv_friends_task_btn).text = data.button

        if (data.button == "去邀请") {
            convertView.findViewById<TextView>(R.id.item_bv_friends_task_btn).setBackgroundResource(R.drawable.shape_btn_orange)
            convertView.findViewById<TextView>(R.id.item_bv_friends_task_btn).setTextColor(mContext.resources.getColor(R.color.my_color_orange))
        } else {
            convertView.findViewById<TextView>(R.id.item_bv_friends_task_btn).setBackgroundResource(R.drawable.shape_btn_orange_complete)
            convertView.findViewById<TextView>(R.id.item_bv_friends_task_btn).setTextColor(Color.WHITE)
        }
    }

}