|
|
package com.br_technology.securitytrain_master.ui.view.home.adapter
|
|
|
|
|
|
import android.content.Context
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.ViewGroup
|
|
|
import com.br_technology.securitytrain_master.R
|
|
|
import com.br_technology.securitytrain_master.base.view.BaseAdapter
|
|
|
import com.br_technology.securitytrain_master.databinding.AdapterVideoCourseBinding
|
|
|
import com.br_technology.securitytrain_master.expand.courseHead
|
|
|
import com.br_technology.securitytrain_master.expand.glideRound
|
|
|
import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonBean
|
|
|
import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse
|
|
|
import com.bumptech.glide.Glide
|
|
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
|
|
import com.bumptech.glide.request.RequestOptions
|
...
|
...
|
@@ -23,19 +15,36 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder |
|
|
* des:
|
|
|
*/
|
|
|
class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.ListBean.DataBean>?) :
|
|
|
BaseQuickAdapter<VideoLessonBean.ListBean.DataBean, BaseViewHolder>(layoutResId, data) ,LoadMoreModule{
|
|
|
BaseQuickAdapter<VideoLessonBean.ListBean.DataBean, BaseViewHolder>(layoutResId, data),
|
|
|
LoadMoreModule {
|
|
|
|
|
|
override fun convert(holder: BaseViewHolder, item: VideoLessonBean.ListBean.DataBean) {
|
|
|
// 视频首贞图片
|
|
|
Glide.with(context).load(item.image).apply(RequestOptions.bitmapTransform(RoundedCorners(14))).into(holder.getView(R.id.video_pic))
|
|
|
Glide.with(context).load(item.image)
|
|
|
.apply(RequestOptions.bitmapTransform(RoundedCorners(14)))
|
|
|
.into(holder.getView(R.id.video_pic))
|
|
|
// 课时
|
|
|
holder.setText(R.id.lesson,item.class_hours.toString() + "课时")
|
|
|
holder.setText(R.id.lesson, item.class_hours.toString() + "课时")
|
|
|
// 视频名称
|
|
|
holder.setText(R.id.course_name,item.name)
|
|
|
holder.setText(R.id.course_name, item.name)
|
|
|
val teacher = item.teacher;
|
|
|
Glide.with(context)
|
|
|
.load(item.teacher.avatar)
|
|
|
.load(
|
|
|
if (teacher == null) {
|
|
|
""
|
|
|
} else {
|
|
|
teacher.avatar
|
|
|
}
|
|
|
)
|
|
|
.placeholder(R.mipmap.placeholder_head)
|
|
|
.into(holder.getView(R.id.head))
|
|
|
holder.setText(R.id.name,item.teacher.name)
|
|
|
holder.setText(
|
|
|
R.id.name, if (teacher == null) {
|
|
|
""
|
|
|
} else {
|
|
|
teacher.name
|
|
|
}
|
|
|
)
|
|
|
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|