package com.zj365.mime.adapter

import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.zj365.mime.R
import com.xty.network.model.SportBean

class SportAdapter: BaseAdapter<SportBean>(R.layout.item_sport) {
    override fun convert(holder: BaseViewHolder, item: SportBean) {
        holder.setText(R.id.mTitle,"${item.planName}|${item.lessonNumber}")
            .setText(R.id.mBodyState,String.format(context.getString(R.string.body_state),item.beforeStamina))
            .setText(R.id.mSleep,String.format(context.getString(R.string.sleep_info),item.beforeSleep))
            .setText(R.id.mTime,"${context.getString(R.string.sport_time)}：${item.startTime}")
            .setText(R.id.mResult,if(item.evaluationResult.isNullOrEmpty()) context.getString(R.string.not_sport_result) else "运动方式：${item.sportsWay}  强度：${item.sportsStrength}%")

        var  state=""
        var  stateCol=0
        when(item.status){
            0->{
                state="待发送"
                stateCol=R.color.col_f66
            }
            1->{
                state="待运动"
                stateCol=R.color.col_96D
            }
            2->{   state="运动中"
                stateCol=R.color.col_96D}
            3->{ state="运动完成"
                stateCol=R.color.col_96D}
            4->{ state="已完成"
                stateCol=R.color.col_25c}
        }
        holder.setText(R.id.mState,state).setTextColorRes(R.id.mState,stateCol)




    }
    //待发送，1.待运动，2，运动中，3，   state="待运动"，4，评估完成
}