正在显示
6 个修改的文件
包含
41 行增加
和
40 行删除
@@ -90,34 +90,6 @@ class CourseDetailActivity | @@ -90,34 +90,6 @@ class CourseDetailActivity | ||
90 | } | 90 | } |
91 | }) | 91 | }) |
92 | 92 | ||
93 | -// // 视频数据 | ||
94 | -// mViewModel.mVideoLessonNormal.observe(this, { | ||
95 | -// binding.apply { | ||
96 | -// searchResultAdapter = BasePagerAdapter( | ||
97 | -// supportFragmentManager, | ||
98 | -// FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT | ||
99 | -// ) | ||
100 | -// val list = | ||
101 | -// mutableListOf( | ||
102 | -// OnlineDetailFragment( | ||
103 | -// TrainClassDes( | ||
104 | -// courseLesson?.name ?: "", | ||
105 | -// courseLesson?.pos_ids ?: "", | ||
106 | -// courseLesson?.content ?: "" | ||
107 | -// ), TYPE_COURSE_DETAIL_ITEM_NORMAL | ||
108 | -// ), | ||
109 | -// CourseListFragment(TrainCourseData(TYPE_COURSE_DETAIL_ITEM_NORMAL).apply { | ||
110 | -// this.lessonBeanNormal = it.data.detail | ||
111 | -// }, "${courseBean?.mTrainClassId}") | ||
112 | -// ) | ||
113 | -// val titles = listOf("课程详情", "课程列表") | ||
114 | -// searchResultAdapter?.addData(list.toMutableList()) | ||
115 | -// searchResultAdapter?.addTitle(titles) | ||
116 | -// viewPager.adapter = searchResultAdapter | ||
117 | -// tabLayout.setupWithViewPager(viewPager) | ||
118 | -// } | ||
119 | -// }) | ||
120 | - | ||
121 | mViewModel.mLiveLesson.observe(this, { | 93 | mViewModel.mLiveLesson.observe(this, { |
122 | binding.apply { | 94 | binding.apply { |
123 | Glide.with(this@CourseDetailActivity).load(it.data.detail.image).into(ivTop) | 95 | Glide.with(this@CourseDetailActivity).load(it.data.detail.image).into(ivTop) |
@@ -22,6 +22,20 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | @@ -22,6 +22,20 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | ||
22 | var courseBean: CourseParam? = null | 22 | var courseBean: CourseParam? = null |
23 | 23 | ||
24 | override fun initDataObserver() { | 24 | override fun initDataObserver() { |
25 | + mViewModel.mVideoLesson.observe(this, { | ||
26 | + val url = it.data.detail.clazz[0].lessonclassdetail[0].video_url | ||
27 | + val bool = it.data.detail.clazz[0].lessonclassdetail[0].is_complete == 1 | ||
28 | + binding.videoPlayer.apply { | ||
29 | + initVideoBuilderMode( | ||
30 | + "it.data.detail.image", | ||
31 | + url, | ||
32 | + this@VideoDetailActivity, | ||
33 | + true, | ||
34 | + lifecycle | ||
35 | + ) | ||
36 | + setCantTouch(bool) | ||
37 | + } | ||
38 | + }) | ||
25 | } | 39 | } |
26 | 40 | ||
27 | override fun initView() { | 41 | override fun initView() { |
@@ -31,25 +45,19 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | @@ -31,25 +45,19 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity | ||
31 | if (!TextUtils.isEmpty(intent.getStringExtra(ConstantParamKey.COMMON_URL))) { | 45 | if (!TextUtils.isEmpty(intent.getStringExtra(ConstantParamKey.COMMON_URL))) { |
32 | mViewModel.record(timeGet(binding.videoPlayer.getProgressTime())) | 46 | mViewModel.record(timeGet(binding.videoPlayer.getProgressTime())) |
33 | } | 47 | } |
48 | + if (!isPause && isFinish) { | ||
49 | + binding.videoPlayer.setCantTouch(true) | ||
50 | + } | ||
34 | } | 51 | } |
35 | } | 52 | } |
36 | } | 53 | } |
37 | 54 | ||
38 | override fun initData() { | 55 | override fun initData() { |
39 | super.initData() | 56 | super.initData() |
40 | - val url = intent.getStringExtra(ConstantParamKey.COMMON_URL) | 57 | + val id = intent.getIntExtra(ConstantParamKey.LESSON_ID, 0) |
41 | courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN) | 58 | courseBean = intent.getParcelableExtra(ConstantParamKey.COURSE_BEAN) |
59 | + mViewModel.videoLessonsDetail(id) | ||
42 | mViewModel.courseParam.value = courseBean | 60 | mViewModel.courseParam.value = courseBean |
43 | - url?.apply { | ||
44 | - binding.videoPlayer.initVideoBuilderMode( | ||
45 | - "it.data.detail.image", | ||
46 | -// it.data.detail.classX[0].lessonclassdetail[0].video_url | ||
47 | - url, | ||
48 | - this@VideoDetailActivity, | ||
49 | - true, | ||
50 | - lifecycle | ||
51 | - ) | ||
52 | - } | ||
53 | } | 61 | } |
54 | 62 | ||
55 | fun timeGet(str: String): String { | 63 | fun timeGet(str: String): String { |
@@ -3,6 +3,7 @@ package com.br_technology.securitytrain_master.ui.view.home.adapter | @@ -3,6 +3,7 @@ package com.br_technology.securitytrain_master.ui.view.home.adapter | ||
3 | import android.content.Intent | 3 | import android.content.Intent |
4 | import android.view.View | 4 | import android.view.View |
5 | import com.br_technology.securitytrain_master.R | 5 | import com.br_technology.securitytrain_master.R |
6 | +import com.br_technology.securitytrain_master.base.common.ConstantParamKey | ||
6 | import com.br_technology.securitytrain_master.ui.view.home.activity.course.VideoDetailActivity | 7 | import com.br_technology.securitytrain_master.ui.view.home.activity.course.VideoDetailActivity |
7 | import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean | 8 | import com.br_technology.securitytrain_master.ui.view.home.bean.VideoLessonDetailBean |
8 | import com.br_technology.securitytrain_master.util.TimeFenMUtils | 9 | import com.br_technology.securitytrain_master.util.TimeFenMUtils |
@@ -32,7 +33,7 @@ class VideoCourseListSecondProvider : BaseNodeProvider() { | @@ -32,7 +33,7 @@ class VideoCourseListSecondProvider : BaseNodeProvider() { | ||
32 | data as VideoLessonDetailBean.DetailBean.ClassBean.LessonclassdetailBean | 33 | data as VideoLessonDetailBean.DetailBean.ClassBean.LessonclassdetailBean |
33 | context.startActivity( | 34 | context.startActivity( |
34 | Intent(context, VideoDetailActivity::class.java) | 35 | Intent(context, VideoDetailActivity::class.java) |
35 | - .putExtra("id", lessonDetailBean.id) | 36 | + .putExtra(ConstantParamKey.LESSON_ID, lessonDetailBean.lesson_id) |
36 | .putExtra("train_class_id", lessonDetailBean.lesson_id) | 37 | .putExtra("train_class_id", lessonDetailBean.lesson_id) |
37 | ) | 38 | ) |
38 | } | 39 | } |
app/src/main/java/com/br_technology/securitytrain_master/ui/view/home/fragment/CourseListFragment.kt
@@ -4,6 +4,7 @@ import android.content.Intent | @@ -4,6 +4,7 @@ import android.content.Intent | ||
4 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey | 4 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey |
5 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COMMON_URL | 5 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COMMON_URL |
6 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN | 6 | import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN |
7 | +import com.br_technology.securitytrain_master.base.common.ConstantParamKey.LESSON_ID | ||
7 | import com.br_technology.securitytrain_master.databinding.FragmentCourseListBinding | 8 | import com.br_technology.securitytrain_master.databinding.FragmentCourseListBinding |
8 | import com.br_technology.securitytrain_master.ui.bean.TrainCourseData | 9 | import com.br_technology.securitytrain_master.ui.bean.TrainCourseData |
9 | import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItem | 10 | import com.br_technology.securitytrain_master.ui.bean.TrainCourseDetailItem |
@@ -80,6 +81,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | @@ -80,6 +81,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | ||
80 | startActivity( | 81 | startActivity( |
81 | Intent(activity, VideoDetailActivity::class.java) | 82 | Intent(activity, VideoDetailActivity::class.java) |
82 | .putExtra(COMMON_URL, item.lessonVideoChild?.video_url) | 83 | .putExtra(COMMON_URL, item.lessonVideoChild?.video_url) |
84 | + .putExtra(LESSON_ID, item.lessonVideoChild?.lesson_id?.toInt()) | ||
83 | .putExtra(COURSE_BEAN, param) | 85 | .putExtra(COURSE_BEAN, param) |
84 | ) | 86 | ) |
85 | } | 87 | } |
@@ -88,6 +90,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | @@ -88,6 +90,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | ||
88 | startActivity( | 90 | startActivity( |
89 | Intent(activity, VideoDetailActivity::class.java) | 91 | Intent(activity, VideoDetailActivity::class.java) |
90 | .putExtra(COMMON_URL, item.lessonVideoNormalChild?.video_url) | 92 | .putExtra(COMMON_URL, item.lessonVideoNormalChild?.video_url) |
93 | + .putExtra(LESSON_ID, item.lessonVideoNormalChild?.lesson_id?.toInt()) | ||
91 | .putExtra( | 94 | .putExtra( |
92 | COURSE_BEAN, | 95 | COURSE_BEAN, |
93 | (activity as CourseDetailActivity).getCourseBean() | 96 | (activity as CourseDetailActivity).getCourseBean() |
@@ -99,6 +102,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | @@ -99,6 +102,7 @@ class CourseListFragment(var courseData: TrainCourseData, var tranClassId: Strin | ||
99 | startActivity( | 102 | startActivity( |
100 | Intent(activity, VideoDetailActivity::class.java) | 103 | Intent(activity, VideoDetailActivity::class.java) |
101 | .putExtra(COMMON_URL, item.lessonLiveChild?.webrtc_url) | 104 | .putExtra(COMMON_URL, item.lessonLiveChild?.webrtc_url) |
105 | + .putExtra(LESSON_ID, item.lessonLiveChild?.id) | ||
102 | .putExtra( | 106 | .putExtra( |
103 | COURSE_BEAN, | 107 | COURSE_BEAN, |
104 | (activity as CourseDetailActivity).getCourseBean() | 108 | (activity as CourseDetailActivity).getCourseBean() |
@@ -5,6 +5,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse | @@ -5,6 +5,7 @@ import com.br_technology.securitytrain_master.base.network.response.BaseResponse | ||
5 | import com.br_technology.securitytrain_master.base.repository.LessonRepository | 5 | import com.br_technology.securitytrain_master.base.repository.LessonRepository |
6 | import com.br_technology.securitytrain_master.base.view.BaseViewModel | 6 | import com.br_technology.securitytrain_master.base.view.BaseViewModel |
7 | import com.br_technology.securitytrain_master.ui.bean.CourseParam | 7 | import com.br_technology.securitytrain_master.ui.bean.CourseParam |
8 | +import com.br_technology.securitytrain_master.ui.bean.LessonTrainVideoDetail | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * Time: 12/8/2021 15:46 | 11 | * Time: 12/8/2021 15:46 |
@@ -17,6 +18,8 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | @@ -17,6 +18,8 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | ||
17 | 18 | ||
18 | val record = MutableLiveData<BaseResponse<Void>>() | 19 | val record = MutableLiveData<BaseResponse<Void>>() |
19 | 20 | ||
21 | + val mVideoLesson = MutableLiveData<BaseResponse<LessonTrainVideoDetail>>() | ||
22 | + | ||
20 | fun record( | 23 | fun record( |
21 | view_len: String | 24 | view_len: String |
22 | ) { | 25 | ) { |
@@ -37,4 +40,10 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | @@ -37,4 +40,10 @@ class VideoDetailViewModel : BaseViewModel<LessonRepository>() { | ||
37 | } | 40 | } |
38 | } | 41 | } |
39 | } | 42 | } |
43 | + | ||
44 | + fun videoLessonsDetail( | ||
45 | + id: Int | ||
46 | + ) { | ||
47 | + mRepository.lessonVideoDetail(id, mVideoLesson) | ||
48 | + } | ||
40 | } | 49 | } |
@@ -25,6 +25,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | @@ -25,6 +25,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | ||
25 | private var isPlay = false | 25 | private var isPlay = false |
26 | 26 | ||
27 | private var isPause = false | 27 | private var isPause = false |
28 | + private var canTouchProgress = false | ||
28 | 29 | ||
29 | private var orientationUtils: OrientationUtils? = null | 30 | private var orientationUtils: OrientationUtils? = null |
30 | 31 | ||
@@ -67,6 +68,12 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | @@ -67,6 +68,12 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { | ||
67 | showFull() | 68 | showFull() |
68 | } | 69 | } |
69 | } | 70 | } |
71 | + mProgressBar.isEnabled = canTouchProgress | ||
72 | + } | ||
73 | + | ||
74 | + fun setCantTouch(bool: Boolean) { | ||
75 | + canTouchProgress = bool | ||
76 | + mProgressBar.isEnabled = canTouchProgress | ||
70 | } | 77 | } |
71 | 78 | ||
72 | private fun showFull() { | 79 | private fun showFull() { |
-
请 注册 或 登录 后发表评论