...
|
...
|
@@ -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()
|
...
|
...
|
|