作者 杨谦

...刷新课程

... ... @@ -44,6 +44,7 @@ open class LessonVideo(
open class LessonClazz(
var id: Int,
var name: String,
var lesson_id: String,
var lessonclassdetail: List<LessonClassDetail>
) : Serializable
... ...
... ... @@ -304,9 +304,9 @@ class CourseDetailActivity
mViewModel.offLessonDetail(it.mLessonId.toInt())
}
}
if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF && !it.isFinished) {
showDialogId()
}
// if (it.type != TYPE_COURSE_DETAIL_ITEM_OFF && !it.isFinished) {
// showDialogId()
// }
}
})
}
... ...
... ... @@ -4,10 +4,12 @@ import android.text.TextUtils
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding
import com.br_technology.securitytrain_master.ui.bean.CourseParam
import com.br_technology.securitytrain_master.ui.view.home.event.VideoClassChange
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.VideoDetailViewModel
import com.br_technology.securitytrain_master.view.MyVideoPlayer
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
import org.greenrobot.eventbus.EventBus
import java.math.BigDecimal
/**
... ... @@ -47,6 +49,8 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
}
if (!isPause && isFinish) {
binding.videoPlayer.setCantTouch(true)
EventBus.getDefault()
.post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true))
}
}
}
... ...
... ... @@ -11,4 +11,6 @@ class StatusTypeEvent(var id: Int, var name: String)
class TransType(var id: Int)
class CheckFace()
\ No newline at end of file
class CheckFace()
class VideoClassChange(var lessonId: String, var isFinish: Boolean)
\ No newline at end of file
... ...
... ... @@ -18,8 +18,11 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.Locat
import com.br_technology.securitytrain_master.ui.view.home.activity.course.VideoDetailActivity
import com.br_technology.securitytrain_master.ui.view.home.adapter.CourseDetailListAdapter
import com.br_technology.securitytrain_master.ui.view.home.adapter.IItemClick
import com.br_technology.securitytrain_master.ui.view.home.event.VideoClassChange
import com.br_technology.securitytrain_master.ui.view.home.viewmodel.CourseListViewModel
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/**
* Time: 7/30/2021 16:08
... ... @@ -33,9 +36,35 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
override fun initData() {
super.initData()
EventBus.getDefault().register(this)
transData()
}
override fun onDestroyView() {
EventBus.getDefault().unregister(this)
super.onDestroyView()
}
@Subscribe
fun refreshItem(search: VideoClassChange) {
if (courseData.getTypeData() == TYPE_COURSE_DETAIL_ITEM_VIDEO) {
val adapter = binding.recyclerview.adapter
if (adapter != null) {
courseData.lessonBean?.apply {
for ((index, p) in class_list.withIndex()) {
if (p.lesson_id == search.lessonId) {
if (p.lessonclassdetail.isNotEmpty()){
p.lessonclassdetail[0].is_complete = 1
}
adapter.notifyItemChanged(index)
break
}
}
}
}
}
}
private fun transData() {
val dataList = mutableListOf<TrainCourseDetailItem>()
when (courseData.getTypeData()) {
... ... @@ -90,7 +119,10 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin
startActivity(
Intent(activity, VideoDetailActivity::class.java)
.putExtra(COMMON_URL, item.lessonVideoNormalChild?.video_url)
.putExtra(LESSON_ID, item.lessonVideoNormalChild?.lesson_id?.toInt())
.putExtra(
LESSON_ID,
item.lessonVideoNormalChild?.lesson_id?.toInt()
)
.putExtra(
COURSE_BEAN,
(activity as CourseDetailActivity).getCourseBean()
... ...