作者 刘纪龙

Loong:全屏播放 班级任务练习题

@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <component name="GradleSettings"> 4 <component name="GradleSettings">
5 <option name="linkedExternalProjectsSettings"> 5 <option name="linkedExternalProjectsSettings">
6 <GradleProjectSettings> 6 <GradleProjectSettings>
7 - <option name="testRunner" value="PLATFORM" /> 7 + <option name="testRunner" value="GRADLE" />
8 <option name="disableWrapperSourceDistributionNotification" value="true" /> 8 <option name="disableWrapperSourceDistributionNotification" value="true" />
9 <option name="distributionType" value="DEFAULT_WRAPPED" /> 9 <option name="distributionType" value="DEFAULT_WRAPPED" />
10 <option name="externalProjectPath" value="$PROJECT_DIR$" /> 10 <option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -12,7 +12,6 @@ @@ -12,7 +12,6 @@
12 <option name="modules"> 12 <option name="modules">
13 <set> 13 <set>
14 <option value="$PROJECT_DIR$" /> 14 <option value="$PROJECT_DIR$" />
15 - <option value="$PROJECT_DIR$/Library" />  
16 <option value="$PROJECT_DIR$/app" /> 15 <option value="$PROJECT_DIR$/app" />
17 </set> 16 </set>
18 </option> 17 </option>
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
  3 + <component name="DesignSurface">
  4 + <option name="filePathToZoomLevelMap">
  5 + <map>
  6 + <entry key="../../../../../Applications/Android Studio.app/Contents/caches/transforms-2/files-2.1/054febce6621ffe68244bdc38929a80b/jetified-gsyVideoPlayer-java-v8.3.3-release-jitpack/res/drawable/video_seek_progress.xml" value="0.1361111111111111" />
  7 + <entry key="../../../Library/Android/sdk/platforms/android-30/data/res/layout/auto_complete_list.xml" value="0.2671875" />
  8 + <entry key="app/src/main/res/layout/activity_answer_record_details.xml" value="0.2671875" />
  9 + <entry key="app/src/main/res/layout/activity_answer_sheet.xml" value="0.2671875" />
  10 + <entry key="app/src/main/res/layout/activity_class_duty.xml" value="0.2671875" />
  11 + <entry key="app/src/main/res/layout/activity_database_detail.xml" value="0.2671875" />
  12 + <entry key="app/src/main/res/layout/activity_main.xml" value="0.2671875" />
  13 + <entry key="app/src/main/res/layout/activity_offline_exercise.xml" value="0.2671875" />
  14 + <entry key="app/src/main/res/layout/activity_practice.xml" value="0.2671875" />
  15 + <entry key="app/src/main/res/layout/activity_splash.xml" value="0.2671875" />
  16 + <entry key="app/src/main/res/layout/activity_video_detail.xml" value="0.2671875" />
  17 + <entry key="app/src/main/res/layout/adapter_content_practice_item.xml" value="0.2671875" />
  18 + <entry key="app/src/main/res/layout/dialog_check_id.xml" value="0.33" />
  19 + <entry key="app/src/main/res/layout/fragment_bank.xml" value="0.33" />
  20 + <entry key="app/src/main/res/layout/fragment_class_duty_course.xml" value="0.2671875" />
  21 + <entry key="app/src/main/res/layout/item_course.xml" value="0.22552083333333334" />
  22 + <entry key="app/src/main/res/layout/item_mock_examnation.xml" value="0.2671875" />
  23 + <entry key="app/src/main/res/layout/item_special_exercises.xml" value="0.2671875" />
  24 + <entry key="app/src/main/res/layout/layout_loading.xml" value="0.2671875" />
  25 + <entry key="app/src/main/res/layout/layout_tool_bar.xml" value="0.2671875" />
  26 + <entry key="app/src/main/res/layout/layout_video_player.xml" value="0.13645833333333332" />
  27 + <entry key="app/src/main/res/layout/pop_classify.xml" value="0.3609375" />
  28 + </map>
  29 + </option>
  30 + </component>
3 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> 31 <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
4 <output url="file://$PROJECT_DIR$/build/classes" /> 32 <output url="file://$PROJECT_DIR$/build/classes" />
5 </component> 33 </component>
@@ -5,13 +5,13 @@ plugins { @@ -5,13 +5,13 @@ plugins {
5 } 5 }
6 6
7 android { 7 android {
8 - compileSdkVersion 30 8 + compileSdkVersion 31
9 buildToolsVersion "30.0.3" 9 buildToolsVersion "30.0.3"
10 10
11 defaultConfig { 11 defaultConfig {
12 applicationId "com.br_technology.securitytrain_master" 12 applicationId "com.br_technology.securitytrain_master"
13 minSdkVersion 21 13 minSdkVersion 21
14 - targetSdkVersion 30 14 + targetSdkVersion 31
15 versionCode 1 15 versionCode 1
16 versionName "1.0" 16 versionName "1.0"
17 17
@@ -20,7 +20,12 @@ android { @@ -20,7 +20,12 @@ android {
20 multiDexEnabled true 20 multiDexEnabled true
21 21
22 } 22 }
23 - 23 + aaptOptions {
  24 +// // aapt 附加参数
  25 +// additionalParameters '--rename-manifest-package', 'com.example.classloader_demo2'
  26 + // 是否开启 png 图片优化检查
  27 + cruncherEnabled false
  28 + }
24 buildTypes { 29 buildTypes {
25 release { 30 release {
26 minifyEnabled false 31 minifyEnabled false
@@ -59,7 +64,7 @@ dependencies { @@ -59,7 +64,7 @@ dependencies {
59 implementation 'androidx.appcompat:appcompat:1.1.0' 64 implementation 'androidx.appcompat:appcompat:1.1.0'
60 implementation 'com.google.android.material:material:1.1.0' 65 implementation 'com.google.android.material:material:1.1.0'
61 implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 66 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
62 - implementation project(path: ':Library') 67 +// implementation project(path: ':Library')
63 testImplementation 'junit:junit:4.+' 68 testImplementation 'junit:junit:4.+'
64 androidTestImplementation 'androidx.test.ext:junit:1.1.1' 69 androidTestImplementation 'androidx.test.ext:junit:1.1.1'
65 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 70 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
@@ -111,7 +116,8 @@ dependencies { @@ -111,7 +116,8 @@ dependencies {
111 implementation 'io.github.youth5201314:banner:2.2.2' 116 implementation 'io.github.youth5201314:banner:2.2.2'
112 117
113 //完整版引入 118 //完整版引入
114 - implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.5-jitpack' 119 +// implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.5-jitpack'
  120 + implementation 'com.github.CarGuo.GSYVideoPlayer:GSYVideoPlayer:v8.3.3-release-jitpack'
115 //是否需要 ExoPlayer 模式 121 //是否需要 ExoPlayer 模式
116 // implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:v8.1.5-jitpack' 122 // implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer-exo_player2:v8.1.5-jitpack'
117 //更多 ijk 的编码支持 123 //更多 ijk 的编码支持
@@ -166,8 +166,11 @@ @@ -166,8 +166,11 @@
166 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.MyCredentialsDetailActivity" /> 166 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.MyCredentialsDetailActivity" />
167 <activity 167 <activity
168 android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.OfflineExerciseActivity" 168 android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.OfflineExerciseActivity"
169 - android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"  
170 - android:screenOrientation="portrait" /> 169 + android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
  170 + android:supportsPictureInPicture="true"
  171 + android:launchMode="singleTask"
  172 + android:screenOrientation="portrait"
  173 + android:windowSoftInputMode="adjustPan" />
171 174
172 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.LearningReportActivity" /> 175 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.LearningReportActivity" />
173 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.LearningReportDetailActivity" /> 176 <activity android:name="com.br_technology.securitytrain_master.ui.view.mine.activity.LearningReportDetailActivity" />
@@ -184,8 +187,12 @@ @@ -184,8 +187,12 @@
184 <activity android:name="com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity" /> 187 <activity android:name="com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity" />
185 <activity 188 <activity
186 android:name=".ui.view.home.activity.course.VideoDetailActivity" 189 android:name=".ui.view.home.activity.course.VideoDetailActivity"
187 - android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"  
188 - android:screenOrientation="portrait" /> 190 + android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
  191 + android:supportsPictureInPicture="true"
  192 + android:launchMode="singleTask"
  193 + android:screenOrientation="portrait"
  194 + android:windowSoftInputMode="adjustPan">
  195 + </activity>
189 <activity android:name=".ui.view.bank.activity.QuestionsActivity" /> 196 <activity android:name=".ui.view.bank.activity.QuestionsActivity" />
190 <activity android:name=".ui.view.bank.activity.PracticeListActivity" /> 197 <activity android:name=".ui.view.bank.activity.PracticeListActivity" />
191 198
@@ -89,7 +89,7 @@ interface TrainApi : ApiService { @@ -89,7 +89,7 @@ interface TrainApi : ApiService {
89 @FormUrlEncoded 89 @FormUrlEncoded
90 @POST("/api/train/start_exam") 90 @POST("/api/train/start_exam")
91 fun startExam( 91 fun startExam(
92 - @Field("train_exam_id") train_exam_id: Int 92 + @Field("train_exam_id") train_exam_id: String
93 ): Observable<BaseResponse<SubjectData>> 93 ): Observable<BaseResponse<SubjectData>>
94 94
95 /** 95 /**
@@ -78,7 +78,7 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa @@ -78,7 +78,7 @@ class TrainRepository(val loadState: MutableLiveData<State>) : ApiRepository(loa
78 train_exam_id: String, 78 train_exam_id: String,
79 liveData: MutableLiveData<BaseResponse<SubjectData>> 79 liveData: MutableLiveData<BaseResponse<SubjectData>>
80 ) { 80 ) {
81 - addRequest(trainService.startExamExp(train_exam_id), liveData) 81 + addRequest(trainService.startExam(train_exam_id), liveData)
82 } 82 }
83 83
84 fun trainChatList( 84 fun trainChatList(
1 -package com.wjx.android.wanandroidmvvm.base.view 1 +package com.br_technology.securitytrain_master.base.view
2 2
3 3
4 import android.app.Activity 4 import android.app.Activity
@@ -18,7 +18,6 @@ import com.br_technology.securitytrain_master.R @@ -18,7 +18,6 @@ import com.br_technology.securitytrain_master.R
18 import com.br_technology.securitytrain_master.base.common.CommonUtil 18 import com.br_technology.securitytrain_master.base.common.CommonUtil
19 import com.br_technology.securitytrain_master.base.common.State 19 import com.br_technology.securitytrain_master.base.common.State
20 import com.br_technology.securitytrain_master.base.common.StateType 20 import com.br_technology.securitytrain_master.base.common.StateType
21 -import com.br_technology.securitytrain_master.base.view.BaseViewModel  
22 import com.br_technology.securitytrain_master.expand.statusBarHeight 21 import com.br_technology.securitytrain_master.expand.statusBarHeight
23 import com.br_technology.securitytrain_master.util.AppManager 22 import com.br_technology.securitytrain_master.util.AppManager
24 import com.br_technology.securitytrain_master.util.RevealUtil.setReveal 23 import com.br_technology.securitytrain_master.util.RevealUtil.setReveal
@@ -13,6 +13,7 @@ import com.br_technology.securitytrain_master.ui.view.common.FileReadActivity @@ -13,6 +13,7 @@ import com.br_technology.securitytrain_master.ui.view.common.FileReadActivity
13 import com.br_technology.securitytrain_master.ui.view.home.adapter.PdfAdapter 13 import com.br_technology.securitytrain_master.ui.view.home.adapter.PdfAdapter
14 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.DatabaseDetailViewModel 14 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.DatabaseDetailViewModel
15 import com.br_technology.securitytrain_master.view.listener.OnItemClickListener 15 import com.br_technology.securitytrain_master.view.listener.OnItemClickListener
  16 +import com.gyf.immersionbar.ImmersionBar
16 import com.shuyu.gsyvideoplayer.GSYVideoManager 17 import com.shuyu.gsyvideoplayer.GSYVideoManager
17 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 18 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
18 19
@@ -25,6 +26,8 @@ class DatabaseDetailActivity : @@ -25,6 +26,8 @@ class DatabaseDetailActivity :
25 BaseLifeCycleActivity<DatabaseDetailViewModel, ActivityDatabaseDetailBinding>( 26 BaseLifeCycleActivity<DatabaseDetailViewModel, ActivityDatabaseDetailBinding>(
26 ActivityDatabaseDetailBinding::inflate 27 ActivityDatabaseDetailBinding::inflate
27 ) { 28 ) {
  29 +
  30 +
28 override fun onCreate(savedInstanceState: Bundle?) { 31 override fun onCreate(savedInstanceState: Bundle?) {
29 super.onCreate(savedInstanceState) 32 super.onCreate(savedInstanceState)
30 33
@@ -32,6 +35,17 @@ class DatabaseDetailActivity : @@ -32,6 +35,17 @@ class DatabaseDetailActivity :
32 back.setOnClickListener { 35 back.setOnClickListener {
33 finish() 36 finish()
34 } 37 }
  38 + videoPlayer.apply {
  39 + setFullOnClick{
  40 + if(!it) {
  41 + binding.toolBar.visibility = View.GONE
  42 + binding.inTitle.root.visibility = View.GONE
  43 + }else{
  44 + binding.toolBar.visibility= View.VISIBLE
  45 + binding.inTitle.root.visibility= View.VISIBLE
  46 + ImmersionBar.with(this@DatabaseDetailActivity).transparentStatusBar().statusBarDarkFont(true).init()
  47 + }}
  48 + }
35 videoPlayer.titleTextView.visibility = View.GONE 49 videoPlayer.titleTextView.visibility = View.GONE
36 videoPlayer.backButton.visibility = View.GONE 50 videoPlayer.backButton.visibility = View.GONE
37 start.setOnClickListener { 51 start.setOnClickListener {
@@ -101,6 +115,6 @@ class DatabaseDetailActivity : @@ -101,6 +115,6 @@ class DatabaseDetailActivity :
101 override fun onConfigurationChanged(newConfig: Configuration) { 115 override fun onConfigurationChanged(newConfig: Configuration) {
102 super.onConfigurationChanged(newConfig) 116 super.onConfigurationChanged(newConfig)
103 //如果旋转了就全屏 117 //如果旋转了就全屏
104 - binding.videoPlayer.onConfigurationChanged(newConfig, this) 118 +// binding.videoPlayer.onConfigurationChanged(newConfig, this)
105 } 119 }
106 } 120 }
@@ -7,6 +7,7 @@ import androidx.activity.result.contract.ActivityResultContracts @@ -7,6 +7,7 @@ import androidx.activity.result.contract.ActivityResultContracts
7 import androidx.core.content.ContextCompat 7 import androidx.core.content.ContextCompat
8 import com.br_technology.securitytrain_master.R 8 import com.br_technology.securitytrain_master.R
9 import com.br_technology.securitytrain_master.base.common.ConstantParamKey 9 import com.br_technology.securitytrain_master.base.common.ConstantParamKey
  10 +import com.br_technology.securitytrain_master.base.common.StateType
10 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding 11 import com.br_technology.securitytrain_master.databinding.ActivityPracticeBinding
11 import com.br_technology.securitytrain_master.ui.bean.CourseParam 12 import com.br_technology.securitytrain_master.ui.bean.CourseParam
12 import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerSheetActivity 13 import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerSheetActivity
@@ -195,6 +196,12 @@ class CoursePractiseActivity : @@ -195,6 +196,12 @@ class CoursePractiseActivity :
195 196
196 197
197 override fun initDataObserver() { 198 override fun initDataObserver() {
  199 + mViewModel.loadState.observe(this){
  200 + if( it.code== StateType.ERROR){
  201 + finish()
  202 + }
  203 +
  204 + }
198 mViewModel.exam.observe(this) { 205 mViewModel.exam.observe(this) {
199 if (it.code == 1) { 206 if (it.code == 1) {
200 userItemId = it.data.user_item_id 207 userItemId = it.data.user_item_id
@@ -202,6 +209,8 @@ class CoursePractiseActivity : @@ -202,6 +209,8 @@ class CoursePractiseActivity :
202 binding.practicePager.adapter = mPagerAdapter 209 binding.practicePager.adapter = mPagerAdapter
203 } else { 210 } else {
204 ToastUtils.s(baseContext, it.msg) 211 ToastUtils.s(baseContext, it.msg)
  212 + this@CoursePractiseActivity.finish()
  213 +// ToastUtils.s(baseContext, it.msg)
205 } 214 }
206 // countDown(it.data.over_second) 215 // countDown(it.data.over_second)
207 } 216 }
1 package com.br_technology.securitytrain_master.ui.view.home.activity.course 1 package com.br_technology.securitytrain_master.ui.view.home.activity.course
2 2
  3 +import android.content.res.Configuration
3 import android.text.TextUtils 4 import android.text.TextUtils
  5 +import android.view.View
4 import com.br_technology.securitytrain_master.base.common.ConstantParamKey 6 import com.br_technology.securitytrain_master.base.common.ConstantParamKey
5 import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding 7 import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding
6 import com.br_technology.securitytrain_master.ui.bean.CourseParam 8 import com.br_technology.securitytrain_master.ui.bean.CourseParam
7 import com.br_technology.securitytrain_master.ui.view.home.event.VideoClassChange 9 import com.br_technology.securitytrain_master.ui.view.home.event.VideoClassChange
8 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.VideoDetailViewModel 10 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.VideoDetailViewModel
9 import com.br_technology.securitytrain_master.view.MyVideoPlayer 11 import com.br_technology.securitytrain_master.view.MyVideoPlayer
  12 +import com.gyf.immersionbar.ImmersionBar
10 import com.shuyu.gsyvideoplayer.GSYVideoManager 13 import com.shuyu.gsyvideoplayer.GSYVideoManager
11 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 14 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
12 import org.greenrobot.eventbus.EventBus 15 import org.greenrobot.eventbus.EventBus
@@ -54,6 +57,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity @@ -54,6 +57,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
54 mViewModel.courseParam.value = courseBean 57 mViewModel.courseParam.value = courseBean
55 // mViewModel.videoDetail(detailId) 58 // mViewModel.videoDetail(detailId)
56 binding.videoPlayer.apply { 59 binding.videoPlayer.apply {
  60 + setCantTouch(bool)
57 initVideoBuilderMode( 61 initVideoBuilderMode(
58 "it.data.detail.image", 62 "it.data.detail.image",
59 url, 63 url,
@@ -61,7 +65,15 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity @@ -61,7 +65,15 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
61 true, 65 true,
62 lifecycle 66 lifecycle
63 ) 67 )
64 - setCantTouch(bool) 68 + setFullOnClick{
  69 + if(!it) {
  70 + binding.toolBar.visibility = View.GONE
  71 + binding.inTitle.root.visibility = View.GONE
  72 + }else{
  73 + binding.toolBar.visibility= View.VISIBLE
  74 + binding.inTitle.root.visibility= View.VISIBLE
  75 + ImmersionBar.with(this@VideoDetailActivity).transparentStatusBar().statusBarDarkFont(true).init()
  76 + }}
65 } 77 }
66 } 78 }
67 79
@@ -80,4 +92,9 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity @@ -80,4 +92,9 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
80 } 92 }
81 super.onBackPressed() 93 super.onBackPressed()
82 } 94 }
  95 + override fun onConfigurationChanged(newConfig: Configuration) {
  96 + super.onConfigurationChanged(newConfig)
  97 + //如果旋转了就全屏
  98 +// binding.videoPlayer.onConfigurationChanged(newConfig, this)
  99 + }
83 } 100 }
@@ -8,6 +8,7 @@ import com.br_technology.securitytrain_master.databinding.ActivityOfflineExercis @@ -8,6 +8,7 @@ import com.br_technology.securitytrain_master.databinding.ActivityOfflineExercis
8 import com.br_technology.securitytrain_master.ui.view.home.fragment.OffLineCourseListFragment 8 import com.br_technology.securitytrain_master.ui.view.home.fragment.OffLineCourseListFragment
9 import com.br_technology.securitytrain_master.ui.view.mine.fragment.OfflineDetailFragment 9 import com.br_technology.securitytrain_master.ui.view.mine.fragment.OfflineDetailFragment
10 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.OfflineExerciseViewModel 10 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.OfflineExerciseViewModel
  11 +import com.gyf.immersionbar.ImmersionBar
11 import com.shuyu.gsyvideoplayer.GSYVideoManager 12 import com.shuyu.gsyvideoplayer.GSYVideoManager
12 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 13 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
13 14
@@ -28,13 +29,25 @@ class OfflineExerciseActivity : @@ -28,13 +29,25 @@ class OfflineExerciseActivity :
28 override fun initData() { 29 override fun initData() {
29 super.initData() 30 super.initData()
30 binding.apply { 31 binding.apply {
31 - videoPlayer.initVideoBuilderMode(  
32 - "",  
33 - "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4",  
34 - this@OfflineExerciseActivity,  
35 - false,  
36 - lifecycle  
37 - ) 32 + videoPlayer.apply {
  33 + initVideoBuilderMode(
  34 + "",
  35 + "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4",
  36 + this@OfflineExerciseActivity,
  37 + false,
  38 + lifecycle
  39 + )
  40 + setFullOnClick{
  41 + if(!it) {
  42 + binding.toolBar.visibility = View.GONE
  43 + binding.inTitle.root.visibility = View.GONE
  44 + }else{
  45 + binding.toolBar.visibility= View.VISIBLE
  46 + binding.inTitle.root.visibility= View.VISIBLE
  47 + ImmersionBar.with(this@OfflineExerciseActivity).transparentStatusBar().statusBarDarkFont(true).init()
  48 + }}
  49 + }
  50 +
38 videoPlayer.titleTextView.visibility = View.GONE 51 videoPlayer.titleTextView.visibility = View.GONE
39 videoPlayer.backButton.visibility = View.GONE 52 videoPlayer.backButton.visibility = View.GONE
40 53
@@ -64,7 +77,7 @@ class OfflineExerciseActivity : @@ -64,7 +77,7 @@ class OfflineExerciseActivity :
64 override fun onConfigurationChanged(newConfig: Configuration) { 77 override fun onConfigurationChanged(newConfig: Configuration) {
65 super.onConfigurationChanged(newConfig) 78 super.onConfigurationChanged(newConfig)
66 //如果旋转了就全屏 79 //如果旋转了就全屏
67 - binding.videoPlayer.onConfigurationChanged(newConfig, this) 80 +// binding.videoPlayer.onConfigurationChanged(newConfig, this)
68 } 81 }
69 82
70 } 83 }
@@ -164,15 +164,22 @@ class ClassDutyCourseFragment(val type: Int) : @@ -164,15 +164,22 @@ class ClassDutyCourseFragment(val type: Int) :
164 fun paramBean(data: TrainTestData): CourseParam { 164 fun paramBean(data: TrainTestData): CourseParam {
165 val course = CourseParam() 165 val course = CourseParam()
166 course.isTrainClass = true 166 course.isTrainClass = true
167 - course.mTrainClassId = "${  
168 - if (data.isTest) {  
169 - data.practice?.id  
170 - course.isFinished = data.practice?.is_complete == 1  
171 - } else {  
172 - data.exam?.id  
173 - course.isFinished = data.exam?.is_complete == 1  
174 - }  
175 - }" 167 + if (data.isTest) {
  168 + course.mTrainClassId = data.practice?.id.toString()
  169 + course.isFinished = data.practice?.is_complete == 1
  170 + } else {
  171 + course.mTrainClassId = data.exam?.id.toString()
  172 + course.isFinished = data.exam?.is_complete == 1
  173 + }
  174 +// course.mTrainClassId = "${
  175 +// if (data.isTest) {
  176 +// data.practice?.id
  177 +// course.isFinished = data.practice?.is_complete == 1
  178 +// } else {
  179 +// data.exam?.id
  180 +// course.isFinished = data.exam?.is_complete == 1
  181 +// }
  182 +// }"
176 course.type = data.itemType 183 course.type = data.itemType
177 return course 184 return course
178 } 185 }
@@ -297,14 +304,19 @@ class ClassDutyCourseFragment(val type: Int) : @@ -297,14 +304,19 @@ class ClassDutyCourseFragment(val type: Int) :
297 } 304 }
298 305
299 fun startNext(item: TrainTestData) { 306 fun startNext(item: TrainTestData) {
  307 +// if(!item.isTest){
  308 +// Toast.makeText(activity, "学员未完成培训课程,无法考试", Toast.LENGTH_SHORT).show()
  309 +// return
  310 +// }
300 if (item.isTest && item.exam?.count!! <= 0) { 311 if (item.isTest && item.exam?.count!! <= 0) {
301 Toast.makeText(activity, "该考试暂无题目", Toast.LENGTH_SHORT).show() 312 Toast.makeText(activity, "该考试暂无题目", Toast.LENGTH_SHORT).show()
302 return 313 return
303 } 314 }
304 - if (item.isTest && item.practice?.count!! <= 0) { 315 + if (item.isTest && (item.practice?.count!! <= 0)) {
305 Toast.makeText(activity, "该练习暂无题目", Toast.LENGTH_SHORT).show() 316 Toast.makeText(activity, "该练习暂无题目", Toast.LENGTH_SHORT).show()
306 return 317 return
307 } 318 }
  319 +
308 this@ClassDutyCourseFragment.startActivity( 320 this@ClassDutyCourseFragment.startActivity(
309 Intent( 321 Intent(
310 requireActivity(), 322 requireActivity(),
@@ -21,7 +21,7 @@ import java.io.File @@ -21,7 +21,7 @@ import java.io.File
21 * PS: Not easy to write code, please indicate. 21 * PS: Not easy to write code, please indicate.
22 */ 22 */
23 class FaceUtil { 23 class FaceUtil {
24 - companion object{ 24 + companion object {
25 const val FRONT_CAPTURE_CODE = 998 25 const val FRONT_CAPTURE_CODE = 998
26 } 26 }
27 27
@@ -33,7 +33,7 @@ class FaceUtil { @@ -33,7 +33,7 @@ class FaceUtil {
33 fun capture(file: File) 33 fun capture(file: File)
34 } 34 }
35 35
36 - interface ICompress{ 36 + interface ICompress {
37 fun compress(file: File) 37 fun compress(file: File)
38 } 38 }
39 39
@@ -96,7 +96,7 @@ class FaceUtil { @@ -96,7 +96,7 @@ class FaceUtil {
96 iCapture.capture(fileUploadTemp!!) 96 iCapture.capture(fileUploadTemp!!)
97 } 97 }
98 98
99 - fun compressFile(activity: Activity,file: File,iCompress: ICompress) { 99 + fun compressFile(activity: Activity, file: File, iCompress: ICompress) {
100 if (compressImageUtil == null) { 100 if (compressImageUtil == null) {
101 val compressConfig: CompressConfig = CompressConfig.builder() 101 val compressConfig: CompressConfig = CompressConfig.builder()
102 .setUnCompressMinPixel(1000) // 最小像素不压缩,默认值:1000 102 .setUnCompressMinPixel(1000) // 最小像素不压缩,默认值:1000
@@ -2,9 +2,14 @@ package com.br_technology.securitytrain_master.view @@ -2,9 +2,14 @@ package com.br_technology.securitytrain_master.view
2 2
3 import android.app.Activity 3 import android.app.Activity
4 import android.content.Context 4 import android.content.Context
  5 +import android.content.pm.ActivityInfo
5 import android.content.res.Configuration 6 import android.content.res.Configuration
  7 +import android.os.Build
6 import android.text.TextUtils 8 import android.text.TextUtils
7 import android.util.AttributeSet 9 import android.util.AttributeSet
  10 +import android.util.TypedValue
  11 +import android.view.ViewGroup
  12 +import android.view.WindowManager
8 import android.widget.ImageView 13 import android.widget.ImageView
9 import androidx.lifecycle.Lifecycle 14 import androidx.lifecycle.Lifecycle
10 import androidx.lifecycle.LifecycleObserver 15 import androidx.lifecycle.LifecycleObserver
@@ -29,8 +34,13 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -29,8 +34,13 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
29 private var isPause = false 34 private var isPause = false
30 private var canTouchProgress = false 35 private var canTouchProgress = false
31 36
  37 + private var isFull = false
  38 +
32 private var orientationUtils: OrientationUtils? = null 39 private var orientationUtils: OrientationUtils? = null
33 40
  41 + //全屏点击事件
  42 + private var fullOnClickListener: ((t: Boolean) -> Unit?)? = null
  43 +
34 constructor(context: Context) : super(context) 44 constructor(context: Context) : super(context)
35 constructor(context: Context, fullFlag: Boolean) : super(context, fullFlag) 45 constructor(context: Context, fullFlag: Boolean) : super(context, fullFlag)
36 constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) 46 constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
@@ -67,11 +77,19 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -67,11 +77,19 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
67 // } 77 // }
68 if (this.fullscreenButton != null) { 78 if (this.fullscreenButton != null) {
69 this.fullscreenButton.setOnClickListener { 79 this.fullscreenButton.setOnClickListener {
70 - showFull() 80 + showFull(activity)
  81 + }
  82 + }
  83 + if (this.mBackButton != null) {
  84 + this.mBackButton.setOnClickListener {
  85 + if(isFull){
  86 + showFull(activity)
  87 + }else{
  88 + activity.finish()
  89 + }
71 } 90 }
72 } 91 }
73 initPlayer() 92 initPlayer()
74 - mProgressBar.isEnabled = canTouchProgress  
75 } 93 }
76 94
77 private fun initPlayer() { 95 private fun initPlayer() {
@@ -88,24 +106,101 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -88,24 +106,101 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
88 } 106 }
89 } 107 }
90 108
  109 + /**
  110 + * 禁止拖动
  111 + */
91 fun setCantTouch(bool: Boolean) { 112 fun setCantTouch(bool: Boolean) {
92 canTouchProgress = bool 113 canTouchProgress = bool
93 mProgressBar.isEnabled = canTouchProgress 114 mProgressBar.isEnabled = canTouchProgress
94 } 115 }
95 116
96 - private fun showFull() {  
97 - if (orientationUtils!!.isLand != 1) {  
98 - //直接横屏  
99 - orientationUtils!!.resolveByClick()  
100 - } 117 + private fun showFull(activity: Activity) {
101 //第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar 118 //第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
102 - this.startWindowFullscreen(  
103 - context,  
104 - true,  
105 - true 119 +// this.startWindowFullscreen(
  120 +// context,
  121 +// true,
  122 +// true
  123 +// )
  124 + fullOnClickListener?.invoke(isFull)
  125 + changeWindow(activity)
  126 + }
  127 +
  128 + fun setFullOnClick(listener: (t: Boolean) -> Unit) {
  129 + fullOnClickListener = listener
  130 + }
  131 +
  132 + fun changeWindow(activity: Activity) {
  133 + if (!isFull) {
  134 + changeToFull(activity)
  135 + } else {
  136 + changeToPort(activity)
  137 + }
  138 + isFull = !isFull
  139 + }
  140 +
  141 + /**
  142 + * 全屏
  143 + */
  144 + fun changeToFull(activity: Activity) {
  145 +// if (orientationUtils!!.isLand != 1) {
  146 + //直接横屏
  147 + activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
  148 +// orientationUtils!!.resolveByClick()
  149 +// }
  150 + hideNavigationBar(activity)
  151 + hideStatusBar(activity)
  152 + val vlp: ViewGroup.LayoutParams = this.layoutParams
  153 + vlp.width = ViewGroup.LayoutParams.MATCH_PARENT
  154 + vlp.height = ViewGroup.LayoutParams.MATCH_PARENT
  155 + }
  156 +
  157 + /**
  158 + * 竖屏
  159 + */
  160 + fun changeToPort(activity: Activity) {
  161 + activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
  162 + activity.window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
  163 + activity.window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
  164 + val vlp: ViewGroup.LayoutParams = this.getLayoutParams()
  165 + vlp.width = ViewGroup.LayoutParams.MATCH_PARENT
  166 + vlp.height = TypedValue.applyDimension(
  167 + TypedValue.COMPLEX_UNIT_DIP,
  168 + 200F,
  169 + getResources().getDisplayMetrics()
  170 + ).toInt()
  171 + }
  172 +
  173 + /**
  174 + *
  175 + */
  176 + fun hideNavigationBar(activity: Activity) {
  177 + val uiOptions = activity.window.decorView.systemUiVisibility
  178 + activity.window.decorView.systemUiVisibility = uiOptions or SYSTEM_UI_FLAG_HIDE_NAVIGATION
  179 + }
  180 +
  181 + /**
  182 + * 隐藏状态栏
  183 + */
  184 + fun hideStatusBar(activity: Activity) {
  185 + activity.window.setFlags(
  186 + WindowManager.LayoutParams.FLAG_FULLSCREEN,
  187 + WindowManager.LayoutParams.FLAG_FULLSCREEN
106 ) 188 )
  189 + activity.window.setFlags(
  190 + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
  191 + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
  192 + )
  193 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
  194 + val decorView = activity.window.decorView
  195 + val uiOptions = (SYSTEM_UI_FLAG_FULLSCREEN
  196 + or SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
  197 + or SYSTEM_UI_FLAG_IMMERSIVE
  198 + or SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
  199 + decorView.systemUiVisibility = uiOptions
  200 + }
107 } 201 }
108 202
  203 +
109 /** 204 /**
110 * 选择builder模式 205 * 选择builder模式
111 */ 206 */
@@ -123,7 +218,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -123,7 +218,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
123 override fun onPrepared(url: String?, vararg objects: Any?) { 218 override fun onPrepared(url: String?, vararg objects: Any?) {
124 super.onPrepared(url, *objects) 219 super.onPrepared(url, *objects)
125 //开始播放了才能旋转和全屏 220 //开始播放了才能旋转和全屏
126 - orientationUtils!!.isEnable = true 221 +// orientationUtils!!.isEnable = true
127 isPlay = true 222 isPlay = true
128 } 223 }
129 224
@@ -160,7 +255,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -160,7 +255,7 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
160 .setUrl(mp4) 255 .setUrl(mp4)
161 .setCacheWithPlay(true) 256 .setCacheWithPlay(true)
162 .setVideoTitle("") 257 .setVideoTitle("")
163 - .setIsTouchWiget(true) 258 + .setIsTouchWiget(false)
164 .setRotateViewAuto(false) 259 .setRotateViewAuto(false)
165 .setLockLand(false) 260 .setLockLand(false)
166 .setShowFullAnimation(false)//打开动画 261 .setShowFullAnimation(false)//打开动画
@@ -216,17 +311,36 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver { @@ -216,17 +311,36 @@ class MyVideoPlayer : StandardGSYVideoPlayer, LifecycleObserver {
216 } 311 }
217 } 312 }
218 313
219 - 314 + /**
  315 + * 全屏
  316 + */
220 fun onConfigurationChanged(newConfig: Configuration, activity: Activity) { 317 fun onConfigurationChanged(newConfig: Configuration, activity: Activity) {
221 //如果旋转了就全屏 318 //如果旋转了就全屏
222 - if (isPlay && !isPause) {  
223 - this.onConfigurationChanged(  
224 - activity,  
225 - newConfig,  
226 - orientationUtils,  
227 - true,  
228 - true  
229 - )  
230 - } 319 +// val orientation= newConfig.orientation
  320 +// if (orientation > 340 || orientation < 20) {
  321 +// //0
  322 +// changeToPort(activity)
  323 +// } else if (orientation in 71..109) {
  324 +// //90
  325 +// changeToFull(activity)
  326 +// } else if (orientation in 161..199) {
  327 +// //180
  328 +// changeToPort(activity)
  329 +// } else if (orientation in 251..289) {
  330 +// changeToFull(activity)
  331 +//
  332 +// //270
  333 +// }
  334 +
  335 +// if (isPlay && !isPause) {
  336 +// this.onConfigurationChanged(
  337 +// activity,
  338 +// newConfig,
  339 +// orientationUtils,
  340 +// true,
  341 +// true
  342 +// )
  343 +// }
  344 +// changeWindow(activity)
231 } 345 }
232 } 346 }
@@ -5,9 +5,12 @@ @@ -5,9 +5,12 @@
5 android:layout_height="match_parent" 5 android:layout_height="match_parent"
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 - <include layout="@layout/layout_tool_bar" /> 8 + <include
  9 + android:id="@+id/in_title"
  10 + layout="@layout/layout_tool_bar" />
9 11
10 <LinearLayout 12 <LinearLayout
  13 + android:id="@+id/tool_bar"
11 android:layout_width="match_parent" 14 android:layout_width="match_parent"
12 android:layout_height="?actionBarSize" 15 android:layout_height="?actionBarSize"
13 android:gravity="center_vertical" 16 android:gravity="center_vertical"
@@ -5,7 +5,9 @@ @@ -5,7 +5,9 @@
5 android:layout_height="match_parent" 5 android:layout_height="match_parent"
6 android:orientation="vertical"> 6 android:orientation="vertical">
7 7
8 - <include layout="@layout/layout_tool_bar" /> 8 + <include
  9 + android:id="@+id/in_title"
  10 + layout="@layout/layout_tool_bar" />
9 11
10 <com.br_technology.securitytrain_master.view.ViewToolBar 12 <com.br_technology.securitytrain_master.view.ViewToolBar
11 android:id="@+id/tool_bar" 13 android:id="@+id/tool_bar"
@@ -5,11 +5,14 @@ @@ -5,11 +5,14 @@
5 android:orientation="vertical" 5 android:orientation="vertical"
6 android:layout_height="match_parent"> 6 android:layout_height="match_parent">
7 7
8 - <include layout="@layout/layout_tool_bar" /> 8 + <include
  9 + android:id="@+id/in_title"
  10 + layout="@layout/layout_tool_bar" />
9 11
10 <com.br_technology.securitytrain_master.view.ViewToolBar 12 <com.br_technology.securitytrain_master.view.ViewToolBar
11 android:id="@+id/tool_bar" 13 android:id="@+id/tool_bar"
12 android:layout_width="match_parent" 14 android:layout_width="match_parent"
  15 + android:layout_below="@id/title"
13 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
14 android:background="@color/transparent" 17 android:background="@color/transparent"
15 android:visibility="visible" 18 android:visibility="visible"
@@ -18,7 +21,6 @@ @@ -18,7 +21,6 @@
18 <com.br_technology.securitytrain_master.view.MyVideoPlayer 21 <com.br_technology.securitytrain_master.view.MyVideoPlayer
19 android:id="@+id/video_player" 22 android:id="@+id/video_player"
20 android:layout_width="match_parent" 23 android:layout_width="match_parent"
21 - android:layout_height="200dp"  
22 - android:layout_below="@id/tool_bar" /> 24 + android:layout_height="200dp" />
23 25
24 </LinearLayout> 26 </LinearLayout>
不能预览此文件类型
1 include ':app' 1 include ':app'
2 rootProject.name = "SecurityTrain-Master" 2 rootProject.name = "SecurityTrain-Master"
3 -include ':Library' 3 +//include ':Library'