作者 zhangji

班级课程写完

@@ -24,9 +24,12 @@ open class LessonBean( @@ -24,9 +24,12 @@ open class LessonBean(
24 var train_class_id: Int, // 班级课程id 24 var train_class_id: Int, // 班级课程id
25 var train_id: Int, // 培训计划id 25 var train_id: Int, // 培训计划id
26 var sort_id: String, // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课 26 var sort_id: String, // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
  27 + var playerUrl: String, // 直播链接
  28 + var playback_url: String, // 回放链接
27 var name: String, // 课程名称 29 var name: String, // 课程名称
28 var des: String, // 描述 30 var des: String, // 描述
29 var image: String, // 图片 31 var image: String, // 图片
  32 + var train_name: String, // 图片
30 var status: String, // 状态0=未完成1=已完成 33 var status: String, // 状态0=未完成1=已完成
31 var class_hours: Int, // 课时 34 var class_hours: Int, // 课时
32 var user_hours: Int, // 已学习课时 35 var user_hours: Int, // 已学习课时
1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
3 -import android.os.Handler  
4 -import android.os.Looper  
5 import androidx.recyclerview.widget.LinearLayoutManager 3 import androidx.recyclerview.widget.LinearLayoutManager
6 import com.br_technology.securitytrain_master.databinding.ActivityChatBinding 4 import com.br_technology.securitytrain_master.databinding.ActivityChatBinding
7 import com.br_technology.securitytrain_master.expand.hideSoftInputFromWindow 5 import com.br_technology.securitytrain_master.expand.hideSoftInputFromWindow
@@ -3,9 +3,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.adapter @@ -3,9 +3,11 @@ package com.br_technology.securitytrain_master.ui.view.mine.adapter
3 import android.annotation.SuppressLint 3 import android.annotation.SuppressLint
4 import android.widget.TextView 4 import android.widget.TextView
5 import com.br_technology.securitytrain_master.R 5 import com.br_technology.securitytrain_master.R
  6 +import com.br_technology.securitytrain_master.expand.dp2px
6 import com.br_technology.securitytrain_master.ui.bean.LessonBean 7 import com.br_technology.securitytrain_master.ui.bean.LessonBean
7 import com.br_technology.securitytrain_master.util.CommonUtil 8 import com.br_technology.securitytrain_master.util.CommonUtil
8 import com.bumptech.glide.Glide 9 import com.bumptech.glide.Glide
  10 +import com.bumptech.glide.request.RequestOptions
9 import com.chad.library.adapter.base.BaseQuickAdapter 11 import com.chad.library.adapter.base.BaseQuickAdapter
10 import com.chad.library.adapter.base.module.LoadMoreModule 12 import com.chad.library.adapter.base.module.LoadMoreModule
11 import com.chad.library.adapter.base.viewholder.BaseViewHolder 13 import com.chad.library.adapter.base.viewholder.BaseViewHolder
@@ -18,6 +20,8 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder @@ -18,6 +20,8 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder
18 class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item_course), 20 class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item_course),
19 LoadMoreModule { 21 LoadMoreModule {
20 22
  23 + private val option: RequestOptions = RequestOptions().centerCrop()
  24 +
21 interface ITrainItemClick { 25 interface ITrainItemClick {
22 fun itemClick(item: LessonBean) 26 fun itemClick(item: LessonBean)
23 } 27 }
@@ -31,7 +35,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item @@ -31,7 +35,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item
31 @SuppressLint("SetTextI18n") 35 @SuppressLint("SetTextI18n")
32 override fun convert(holder: BaseViewHolder, data: LessonBean) { 36 override fun convert(holder: BaseViewHolder, data: LessonBean) {
33 holder.apply { 37 holder.apply {
34 - getView<TextView>(R.id.tv_title).text = CommonUtil.getTransStr(data.name) 38 + getView<TextView>(R.id.tv_title).text =
  39 + "班级名称:" + CommonUtil.getTransStr(data.train_name)
  40 + getView<TextView>(R.id.tv_title2).text = CommonUtil.getTransStr(data.name)
35 getView<TextView>(R.id.tv_status).text = if (data.status == "0") { 41 getView<TextView>(R.id.tv_status).text = if (data.status == "0") {
36 "未完成" 42 "未完成"
37 } else { 43 } else {
@@ -39,7 +45,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item @@ -39,7 +45,9 @@ class CourseAdapter : BaseQuickAdapter<LessonBean, BaseViewHolder>(R.layout.item
39 } 45 }
40 getView<TextView>(R.id.tv_time).text = CommonUtil.getTransStr(data.create_time_text) 46 getView<TextView>(R.id.tv_time).text = CommonUtil.getTransStr(data.create_time_text)
41 getView<TextView>(R.id.tv_lesson).text = "${data.class_hours}学时" 47 getView<TextView>(R.id.tv_lesson).text = "${data.class_hours}学时"
42 - Glide.with(holder.itemView).load(data.image).error(R.mipmap.placeholder_head) 48 + Glide.with(holder.itemView)
  49 + .load(data.image)
  50 + .apply(option)
43 .into(getView(R.id.iv_pic)) 51 .into(getView(R.id.iv_pic))
44 itemView.setOnClickListener { 52 itemView.setOnClickListener {
45 mListener?.itemClick(data) 53 mListener?.itemClick(data)
@@ -12,6 +12,7 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.Cours @@ -12,6 +12,7 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.Cours
12 import com.br_technology.securitytrain_master.ui.view.home.activity.course.CoursePractiseActivity 12 import com.br_technology.securitytrain_master.ui.view.home.activity.course.CoursePractiseActivity
13 import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity 13 import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextDetailActivity
14 import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent 14 import com.br_technology.securitytrain_master.ui.view.home.event.StatusTypeEvent
  15 +import com.br_technology.securitytrain_master.ui.view.mine.activity.LiveWebActivity
15 import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter 16 import com.br_technology.securitytrain_master.ui.view.mine.adapter.CourseAdapter
16 import com.br_technology.securitytrain_master.ui.view.mine.adapter.TrainTestAdapter 17 import com.br_technology.securitytrain_master.ui.view.mine.adapter.TrainTestAdapter
17 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel 18 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.ClassDutyCourseViewModel
@@ -304,6 +305,25 @@ class ClassDutyCourseFragment(val type: Int) : @@ -304,6 +305,25 @@ class ClassDutyCourseFragment(val type: Int) :
304 // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课 305 // 课程分类:1=视频课,2=直播课,3=线下培训,4=文本课
305 val param = paramLessonBean(response) 306 val param = paramLessonBean(response)
306 when (response.itemType) { 307 when (response.itemType) {
  308 + 2 -> {
  309 + val status = response.status
  310 + if (status == "3") {
  311 + showTip("教师未开播")
  312 + return
  313 + }
  314 + var url = ""
  315 + if (status == "2") {
  316 + url = response.playback_url
  317 + }
  318 + if (status == "1") {
  319 + url = response.playerUrl
  320 + }
  321 + val title = response.name
  322 + val intent = Intent(requireActivity(), LiveWebActivity::class.java)
  323 + intent.putExtra("url", url)
  324 + intent.putExtra("title", title)
  325 + startActivity(intent)
  326 + }
307 4 -> { 327 4 -> {
308 this@ClassDutyCourseFragment.startActivity( 328 this@ClassDutyCourseFragment.startActivity(
309 Intent( 329 Intent(
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 android:layout_width="match_parent" 20 android:layout_width="match_parent"
21 android:layout_height="?actionBarSize" 21 android:layout_height="?actionBarSize"
22 android:overScrollMode="never" 22 android:overScrollMode="never"
23 - app:tabMode="auto" 23 + app:tabMode="fixed"
24 app:tabSelectedTextColor="@color/color_252" 24 app:tabSelectedTextColor="@color/color_252"
25 app:tabTextColor="@color/color_96" /> 25 app:tabTextColor="@color/color_96" />
26 26
@@ -32,8 +32,7 @@ @@ -32,8 +32,7 @@
32 <androidx.viewpager.widget.ViewPager 32 <androidx.viewpager.widget.ViewPager
33 android:id="@+id/view_pager" 33 android:id="@+id/view_pager"
34 android:layout_width="match_parent" 34 android:layout_width="match_parent"
35 - android:layout_height="match_parent"> 35 + android:layout_height="match_parent"/>
36 36
37 - </androidx.viewpager.widget.ViewPager>  
38 37
39 </LinearLayout> 38 </LinearLayout>
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 - android:layout_width="match_parent"  
4 - android:layout_height="258dp"  
5 android:id="@+id/content_course" 3 android:id="@+id/content_course"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="wrap_content"
6 android:layout_marginStart="16dp" 6 android:layout_marginStart="16dp"
7 android:layout_marginEnd="16dp" 7 android:layout_marginEnd="16dp"
8 android:background="@drawable/solid_eff2_4" 8 android:background="@drawable/solid_eff2_4"
@@ -16,14 +16,12 @@ @@ -16,14 +16,12 @@
16 <ImageView 16 <ImageView
17 android:id="@+id/iv_pic" 17 android:id="@+id/iv_pic"
18 android:layout_width="match_parent" 18 android:layout_width="match_parent"
19 - android:layout_height="176dp"  
20 - android:layout_margin="12dp" /> 19 + android:layout_height="176dp" />
21 20
22 <TextView 21 <TextView
23 android:id="@+id/tv_status" 22 android:id="@+id/tv_status"
24 android:layout_width="wrap_content" 23 android:layout_width="wrap_content"
25 android:layout_height="wrap_content" 24 android:layout_height="wrap_content"
26 - android:layout_margin="12dp"  
27 android:background="@mipmap/complete_bg" 25 android:background="@mipmap/complete_bg"
28 android:gravity="center" 26 android:gravity="center"
29 android:text="已完成" 27 android:text="已完成"
@@ -42,6 +40,15 @@ @@ -42,6 +40,15 @@
42 android:textColor="@color/color_32" 40 android:textColor="@color/color_32"
43 android:textSize="14sp" /> 41 android:textSize="14sp" />
44 42
  43 + <TextView
  44 + android:id="@+id/tv_title2"
  45 + android:layout_width="wrap_content"
  46 + android:layout_height="wrap_content"
  47 + android:layout_marginStart="12dp"
  48 + android:text="【直播】课程名称课程名称课程名称"
  49 + android:textColor="@color/color_32"
  50 + android:textSize="14sp" />
  51 +
45 <LinearLayout 52 <LinearLayout
46 android:layout_width="match_parent" 53 android:layout_width="match_parent"
47 android:layout_height="wrap_content" 54 android:layout_height="wrap_content"