作者 zhangji

班级课程写完

... ... @@ -24,9 +24,12 @@ open class LessonBean(
var train_class_id: Int, // 班级课程id
var train_id: Int, // 培训计划id
var sort_id: String, // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
var playerUrl: String, // 直播链接
var playback_url: String, // 回放链接
var name: String, // 课程名称
var des: String, // 描述
var image: String, // 图片
var train_name: String, // 图片
var status: String, // 状态0=未完成1=已完成
var class_hours: Int, // 课时
var user_hours: Int, // 已学习课时
... ...
package com.br_technology.securitytrain_master.ui.view.mine.activity
import android.os.Handler
import android.os.Looper
import androidx.recyclerview.widget.LinearLayoutManager
import com.br_technology.securitytrain_master.databinding.ActivityChatBinding
import com.br_technology.securitytrain_master.expand.hideSoftInputFromWindow
... ...
... ... @@ -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)
... ...
... ... @@ -12,6 +12,7 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.Cours
import com.br_technology.securitytrain_master.ui.view.home.activity.course.CoursePractiseActivity
import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter
import com.br_technology.securitytrain_master.ui.view.mine.adapter.TrainTestAdapter
import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel
... ... @@ -304,6 +305,25 @@ class ClassDutyCourseFragment(val type: Int) :
// 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
val param = paramLessonBean(response)
when (response.itemType) {
2 -> {
val status = response.status
if (status == "3") {
showTip("教师未开播")
return
}
var url = ""
if (status == "2") {
url = response.playback_url
}
if (status == "1") {
url = response.playerUrl
}
val title = response.name
val intent = Intent(requireActivity(), LiveWebActivity::class.java)
intent.putExtra("url", url)
intent.putExtra("title", title)
startActivity(intent)
}
4 -> {
this@ClassDutyCourseFragment.startActivity(
Intent(
... ...
... ... @@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:overScrollMode="never"
app:tabMode="auto"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/color_252"
app:tabTextColor="@color/color_96" />
... ... @@ -32,8 +32,7 @@
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"/>
</androidx.viewpager.widget.ViewPager>
</LinearLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="258dp"
android:id="@+id/content_course"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/solid_eff2_4"
... ... @@ -16,14 +16,12 @@
<ImageView
android:id="@+id/iv_pic"
android:layout_width="match_parent"
android:layout_height="176dp"
android:layout_margin="12dp" />
android:layout_height="176dp" />
<TextView
android:id="@+id/tv_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:background="@mipmap/complete_bg"
android:gravity="center"
android:text="已完成"
... ... @@ -42,6 +40,15 @@
android:textColor="@color/color_32"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_title2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:text="【直播】课程名称课程名称课程名称"
android:textColor="@color/color_32"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
... ...