...
|
...
|
@@ -3,9 +3,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.adapter |
|
|
import android.annotation.SuppressLint
|
|
|
import android.widget.TextView
|
|
|
import com.br_technology.securitytrain_master.R
|
|
|
import com.br_technology.securitytrain_master.expand.dp2px
|
|
|
import com.br_technology.securitytrain_master.ui.bean.LessonBean
|
|
|
import com.br_technology.securitytrain_master.util.CommonUtil
|
|
|
import com.bumptech.glide.Glide
|
|
|
import com.bumptech.glide.request.RequestOptions
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
|
|
import com.chad.library.adapter.base.module.LoadMoreModule
|
|
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
...
|
...
|
@@ -18,6 +20,8 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder |
|
|
class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item_course),
|
|
|
LoadMoreModule {
|
|
|
|
|
|
private val option: RequestOptions = RequestOptions().centerCrop()
|
|
|
|
|
|
interface ITrainItemClick {
|
|
|
fun itemClick(item: LessonBean)
|
|
|
}
|
...
|
...
|
@@ -31,7 +35,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item |
|
|
@SuppressLint("SetTextI18n")
|
|
|
override fun convert(holder: BaseViewHolder, data: LessonBean) {
|
|
|
holder.apply {
|
|
|
getView<TextView>(R.id.tv_title).text = CommonUtil.getTransStr(data.name)
|
|
|
getView<TextView>(R.id.tv_title).text =
|
|
|
"班级名称:" + CommonUtil.getTransStr(data.train_name)
|
|
|
getView<TextView>(R.id.tv_title2).text = CommonUtil.getTransStr(data.name)
|
|
|
getView<TextView>(R.id.tv_status).text = if (data.status == "0") {
|
|
|
"未完成"
|
|
|
} else {
|
...
|
...
|
@@ -39,7 +45,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item |
|
|
}
|
|
|
getView<TextView>(R.id.tv_time).text = CommonUtil.getTransStr(data.create_time_text)
|
|
|
getView<TextView>(R.id.tv_lesson).text = "${data.class_hours}学时"
|
|
|
Glide.with(holder.itemView).load(data.image).error(R.mipmap.placeholder_head)
|
|
|
Glide.with(holder.itemView)
|
|
|
.load(data.image)
|
|
|
.apply(option)
|
|
|
.into(getView(R.id.iv_pic))
|
|
|
itemView.setOnClickListener {
|
|
|
mListener?.itemClick(data)
|
...
|
...
|
|