...
|
...
|
@@ -34,6 +34,7 @@ class CourseDetailActivity |
|
|
private var mapWork = mutableMapOf<Int, WorkTypeBean.ListBean>()
|
|
|
|
|
|
override fun initDataObserver() {
|
|
|
// 培训视频课程
|
|
|
mViewModel.mVideoLesson.observe(this, {
|
|
|
binding.apply {
|
|
|
val posIds = it.data.detail.pos_ids
|
...
|
...
|
@@ -43,8 +44,29 @@ class CourseDetailActivity |
|
|
supportFragmentManager,
|
|
|
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
|
|
)
|
|
|
val list =
|
|
|
mutableListOf(
|
|
|
courseBean?.type?.let { type ->
|
|
|
when (type) {
|
|
|
0 -> {
|
|
|
val list = mutableListOf(
|
|
|
OnlineDetailFragment(
|
|
|
TrainClassDes(
|
|
|
courseLesson?.name ?: "",
|
|
|
courseLesson?.pos_ids ?: "",
|
|
|
courseLesson?.content ?: ""
|
|
|
), TYPE_COURSE_DETAIL_ITEM_NORMAL
|
|
|
),
|
|
|
CourseListFragment(
|
|
|
TrainCourseData(
|
|
|
TYPE_COURSE_DETAIL_ITEM_NORMAL
|
|
|
).apply {
|
|
|
this.lessonBeanNormal = it.data
|
|
|
}, "${courseBean?.mTrainClassId}"
|
|
|
)
|
|
|
)
|
|
|
searchResultAdapter?.addData(list.toMutableList())
|
|
|
}
|
|
|
1 -> {
|
|
|
val list = mutableListOf(
|
|
|
OnlineDetailFragment(
|
|
|
TrainClassDes(
|
|
|
it.data.detail.name,
|
...
|
...
|
@@ -56,41 +78,46 @@ class CourseDetailActivity |
|
|
this.lessonBean = it.data
|
|
|
}, "${courseBean?.mTrainClassId}")
|
|
|
)
|
|
|
val titles = listOf("课程详情", "课程列表")
|
|
|
searchResultAdapter?.addData(list.toMutableList())
|
|
|
searchResultAdapter?.addTitle(titles)
|
|
|
viewPager.adapter = searchResultAdapter
|
|
|
tabLayout.setupWithViewPager(viewPager)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
mViewModel.mVideoLessonNormal.observe(this, {
|
|
|
binding.apply {
|
|
|
searchResultAdapter = BasePagerAdapter(
|
|
|
supportFragmentManager,
|
|
|
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
|
|
)
|
|
|
val list =
|
|
|
mutableListOf(
|
|
|
OnlineDetailFragment(
|
|
|
TrainClassDes(
|
|
|
courseLesson?.name ?: "",
|
|
|
courseLesson?.pos_ids ?: "",
|
|
|
courseLesson?.content ?: ""
|
|
|
), TYPE_COURSE_DETAIL_ITEM_NORMAL
|
|
|
),
|
|
|
CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
|
|
|
this.lessonBeanNormal = it.data.detail
|
|
|
}, "${courseBean?.mTrainClassId}")
|
|
|
)
|
|
|
else -> {}
|
|
|
}
|
|
|
}
|
|
|
val titles = listOf("课程详情", "课程列表")
|
|
|
searchResultAdapter?.addData(list.toMutableList())
|
|
|
searchResultAdapter?.addTitle(titles)
|
|
|
viewPager.adapter = searchResultAdapter
|
|
|
tabLayout.setupWithViewPager(viewPager)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
// // 视频数据
|
|
|
// mViewModel.mVideoLessonNormal.observe(this, {
|
|
|
// binding.apply {
|
|
|
// searchResultAdapter = BasePagerAdapter(
|
|
|
// supportFragmentManager,
|
|
|
// FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
|
|
// )
|
|
|
// val list =
|
|
|
// mutableListOf(
|
|
|
// OnlineDetailFragment(
|
|
|
// TrainClassDes(
|
|
|
// courseLesson?.name ?: "",
|
|
|
// courseLesson?.pos_ids ?: "",
|
|
|
// courseLesson?.content ?: ""
|
|
|
// ), TYPE_COURSE_DETAIL_ITEM_NORMAL
|
|
|
// ),
|
|
|
// CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply {
|
|
|
// this.lessonBeanNormal = it.data.detail
|
|
|
// }, "${courseBean?.mTrainClassId}")
|
|
|
// )
|
|
|
// val titles = listOf("课程详情", "课程列表")
|
|
|
// searchResultAdapter?.addData(list.toMutableList())
|
|
|
// searchResultAdapter?.addTitle(titles)
|
|
|
// viewPager.adapter = searchResultAdapter
|
|
|
// tabLayout.setupWithViewPager(viewPager)
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
mViewModel.mLiveLesson.observe(this, {
|
|
|
binding.apply {
|
|
|
Glide.with(this@CourseDetailActivity).load(it.data.detail.image).into(ivTop)
|
...
|
...
|
@@ -171,20 +198,23 @@ class CourseDetailActivity |
|
|
for (data in it.data.list) {
|
|
|
mapWork.put(data.id, data)
|
|
|
}
|
|
|
//1=视频课,2=直播课,3=线下培训课,4=文本课
|
|
|
//1=视频课,2=直播课,3=线下培训课,4=文本课 0普通视频
|
|
|
courseBean?.let {
|
|
|
when (it.type) {
|
|
|
1 -> {
|
|
|
TYPE_COURSE_DETAIL_ITEM_VIDEO -> {
|
|
|
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
|
|
|
}
|
|
|
TYPE_COURSE_DETAIL_ITEM_NORMAL -> {
|
|
|
if (courseBean?.isTrainClass == true) {
|
|
|
mViewModel.videoLessonsDetail(it.mLessonId.toInt())
|
|
|
} else {
|
|
|
mViewModel.videoLessonNormal(it.mLessonId.toInt())
|
|
|
}
|
|
|
}
|
|
|
2 -> {
|
|
|
TYPE_COURSE_DETAIL_ITEM_LIVE -> {
|
|
|
mViewModel.liveLessonDetail(it.mLessonId.toInt())
|
|
|
}
|
|
|
3 -> {
|
|
|
TYPE_COURSE_DETAIL_ITEM_OFF -> {
|
|
|
mViewModel.offLessonDetail(it.mLessonId.toInt())
|
|
|
}
|
|
|
}
|
...
|
...
|
|