Merge remote-tracking branch 'origin/master'
# Conflicts: # app/src/main/AndroidManifest.xml
正在显示
13 个修改的文件
包含
406 行增加
和
89 行删除
@@ -69,8 +69,10 @@ | @@ -69,8 +69,10 @@ | ||
69 | <activity | 69 | <activity |
70 | android:name=".ui.home.activity.DatabaseActivity" | 70 | android:name=".ui.home.activity.DatabaseActivity" |
71 | android:screenOrientation="portrait" /> | 71 | android:screenOrientation="portrait" /> |
72 | + | ||
72 | <activity | 73 | <activity |
73 | android:name=".ui.home.activity.DatabaseDetailActivity" | 74 | android:name=".ui.home.activity.DatabaseDetailActivity" |
75 | + android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" | ||
74 | android:screenOrientation="portrait" /> | 76 | android:screenOrientation="portrait" /> |
75 | <activity android:name=".ui.home.activity.WebViewActivity" /> | 77 | <activity android:name=".ui.home.activity.WebViewActivity" /> |
76 | <activity android:name=".ui.home.activity.TextCourseActivity" /> | 78 | <activity android:name=".ui.home.activity.TextCourseActivity" /> |
@@ -84,9 +86,7 @@ | @@ -84,9 +86,7 @@ | ||
84 | <activity android:name=".ui.bank.activity.ExamTypeActivity" /> | 86 | <activity android:name=".ui.bank.activity.ExamTypeActivity" /> |
85 | <activity android:name=".ui.bank.activity.ExamDetailActivity" /> | 87 | <activity android:name=".ui.bank.activity.ExamDetailActivity" /> |
86 | <activity android:name=".ui.bank.activity.ExamCardActivity" /> | 88 | <activity android:name=".ui.bank.activity.ExamCardActivity" /> |
87 | - <activity | ||
88 | - android:name=".ui.home.activity.OnlineDetailActivity" | ||
89 | - android:configChanges="orientation|keyboardHidden|screenSize" /> | 89 | + |
90 | <activity android:name=".ui.home.activity.LiveCourseActivity" /> | 90 | <activity android:name=".ui.home.activity.LiveCourseActivity" /> |
91 | <activity android:name=".ui.mine.activity.EditPersonalInfoActivity" /> | 91 | <activity android:name=".ui.mine.activity.EditPersonalInfoActivity" /> |
92 | <activity android:name=".ui.mine.activity.ChangePwdActivity" /> | 92 | <activity android:name=".ui.mine.activity.ChangePwdActivity" /> |
@@ -98,6 +98,10 @@ | @@ -98,6 +98,10 @@ | ||
98 | <activity android:name=".ui.mine.activity.CredentialsUpLoadActivity" /> | 98 | <activity android:name=".ui.mine.activity.CredentialsUpLoadActivity" /> |
99 | <activity android:name=".ui.mine.activity.MyCredentialsDetailActivity" /> | 99 | <activity android:name=".ui.mine.activity.MyCredentialsDetailActivity" /> |
100 | <activity android:name=".ui.mine.activity.OfflineExerciseActivity" /> | 100 | <activity android:name=".ui.mine.activity.OfflineExerciseActivity" /> |
101 | + <activity | ||
102 | + android:name=".ui.home.activity.OnlineDetailActivity" | ||
103 | + android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode" | ||
104 | + android:screenOrientation="portrait" /> | ||
101 | 105 | ||
102 | 106 | ||
103 | </application> | 107 | </application> |
@@ -35,3 +35,10 @@ fun ImageView.courseHead(pic: String) { | @@ -35,3 +35,10 @@ fun ImageView.courseHead(pic: String) { | ||
35 | .placeholder(R.mipmap.placeholder_head) | 35 | .placeholder(R.mipmap.placeholder_head) |
36 | .into(this) | 36 | .into(this) |
37 | } | 37 | } |
38 | +fun ImageView.loadPic(pic: String) { | ||
39 | + Glide.with(this) | ||
40 | + .load(pic) | ||
41 | + .placeholder(R.mipmap.placeholder_head) | ||
42 | + .into(this) | ||
43 | +} | ||
44 | + |
@@ -168,7 +168,7 @@ class DatabaseActivity : | @@ -168,7 +168,7 @@ class DatabaseActivity : | ||
168 | } | 168 | } |
169 | }) | 169 | }) |
170 | databaseRecycler.adapter = resultAdapter | 170 | databaseRecycler.adapter = resultAdapter |
171 | -// resultAdapter.addList(recommendList) | 171 | + resultAdapter.addList(recommendList) |
172 | 172 | ||
173 | 173 | ||
174 | } | 174 | } |
1 | package com.br_technology.securitytrain_master.ui.home.activity | 1 | package com.br_technology.securitytrain_master.ui.home.activity |
2 | 2 | ||
3 | +import android.content.res.Configuration | ||
3 | import android.os.Bundle | 4 | import android.os.Bundle |
5 | +import android.view.View | ||
4 | import com.br_technology.securitytrain_master.databinding.ActivityDatabaseDetailBinding | 6 | import com.br_technology.securitytrain_master.databinding.ActivityDatabaseDetailBinding |
5 | import com.br_technology.securitytrain_master.ui.home.adapter.PdfAdapter | 7 | import com.br_technology.securitytrain_master.ui.home.adapter.PdfAdapter |
6 | import com.br_technology.securitytrain_master.ui.home.viewmodel.DatabaseDetailViewModel | 8 | import com.br_technology.securitytrain_master.ui.home.viewmodel.DatabaseDetailViewModel |
7 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener | 9 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener |
10 | +import com.shuyu.gsyvideoplayer.GSYVideoManager | ||
8 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | 11 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity |
9 | 12 | ||
10 | /** | 13 | /** |
@@ -24,6 +27,17 @@ class DatabaseDetailActivity : | @@ -24,6 +27,17 @@ class DatabaseDetailActivity : | ||
24 | back.setOnClickListener { | 27 | back.setOnClickListener { |
25 | finish() | 28 | finish() |
26 | } | 29 | } |
30 | + | ||
31 | + videoPlayer.initVideoBuilderMode( | ||
32 | + "", | ||
33 | + "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", | ||
34 | + this@DatabaseDetailActivity, | ||
35 | + lifecycle | ||
36 | + ) | ||
37 | + videoPlayer.titleTextView.visibility = View.GONE | ||
38 | + videoPlayer.backButton.visibility = View.GONE | ||
39 | + | ||
40 | + | ||
27 | val data: String = | 41 | val data: String = |
28 | "<p>2021年1月20日0时25分,我国在西昌卫星发射中心用长征三号乙运载火箭," + | 42 | "<p>2021年1月20日0时25分,我国在西昌卫星发射中心用长征三号乙运载火箭," + |
29 | "成功将天通一号03星发射升空。在为中国航天发射带来2021年开门红的同时," + | 43 | "成功将天通一号03星发射升空。在为中国航天发射带来2021年开门红的同时," + |
@@ -65,7 +79,7 @@ class DatabaseDetailActivity : | @@ -65,7 +79,7 @@ class DatabaseDetailActivity : | ||
65 | 79 | ||
66 | webView.loadDataWithBaseURL(null, dataImg, "text/html", "utf-8", null) | 80 | webView.loadDataWithBaseURL(null, dataImg, "text/html", "utf-8", null) |
67 | val pdfAdapter = PdfAdapter() | 81 | val pdfAdapter = PdfAdapter() |
68 | - pdfAdapter.addListener(object :OnItemClickListener<String>{ | 82 | + pdfAdapter.addListener(object : OnItemClickListener<String> { |
69 | override fun onClick(position: Int, data: String) { | 83 | override fun onClick(position: Int, data: String) { |
70 | startActivity(WebViewActivity::class.java) | 84 | startActivity(WebViewActivity::class.java) |
71 | } | 85 | } |
@@ -90,4 +104,20 @@ class DatabaseDetailActivity : | @@ -90,4 +104,20 @@ class DatabaseDetailActivity : | ||
90 | override fun initDataObserver() { | 104 | override fun initDataObserver() { |
91 | 105 | ||
92 | } | 106 | } |
107 | + | ||
108 | + | ||
109 | + override fun onBackPressed() { | ||
110 | + binding.videoPlayer.onBackPressed() | ||
111 | + if (GSYVideoManager.backFromWindowFull(this)) { | ||
112 | + return | ||
113 | + } | ||
114 | + super.onBackPressed() | ||
115 | + } | ||
116 | + | ||
117 | + override fun onConfigurationChanged(newConfig: Configuration) { | ||
118 | + super.onConfigurationChanged(newConfig) | ||
119 | + //如果旋转了就全屏 | ||
120 | + binding.videoPlayer.onConfigurationChanged(newConfig, this) | ||
121 | + } | ||
122 | + | ||
93 | } | 123 | } |
@@ -2,15 +2,22 @@ package com.br_technology.securitytrain_master.ui.home.activity | @@ -2,15 +2,22 @@ package com.br_technology.securitytrain_master.ui.home.activity | ||
2 | 2 | ||
3 | import android.content.res.Configuration | 3 | import android.content.res.Configuration |
4 | import android.view.View | 4 | import android.view.View |
5 | +import android.widget.ImageView | ||
5 | import androidx.fragment.app.FragmentPagerAdapter | 6 | import androidx.fragment.app.FragmentPagerAdapter |
6 | import com.br_technology.securitytrain_master.base.view.BasePagerAdapter | 7 | import com.br_technology.securitytrain_master.base.view.BasePagerAdapter |
7 | import com.br_technology.securitytrain_master.databinding.ActivityOnlineDetailBinding | 8 | import com.br_technology.securitytrain_master.databinding.ActivityOnlineDetailBinding |
9 | +import com.br_technology.securitytrain_master.expand.courseHead | ||
10 | +import com.br_technology.securitytrain_master.expand.glideRound | ||
11 | +import com.br_technology.securitytrain_master.expand.loadPic | ||
8 | import com.br_technology.securitytrain_master.ui.home.fragment.CourseListFragment | 12 | import com.br_technology.securitytrain_master.ui.home.fragment.CourseListFragment |
9 | import com.br_technology.securitytrain_master.ui.home.fragment.OnlineDetailFragment | 13 | import com.br_technology.securitytrain_master.ui.home.fragment.OnlineDetailFragment |
10 | import com.br_technology.securitytrain_master.ui.home.viewmodel.OnlineDetailViewModel | 14 | import com.br_technology.securitytrain_master.ui.home.viewmodel.OnlineDetailViewModel |
11 | import com.shuyu.gsyvideoplayer.GSYVideoManager | 15 | import com.shuyu.gsyvideoplayer.GSYVideoManager |
16 | +import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder | ||
17 | +import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack | ||
18 | +import com.shuyu.gsyvideoplayer.utils.OrientationOption | ||
12 | import com.shuyu.gsyvideoplayer.utils.OrientationUtils | 19 | import com.shuyu.gsyvideoplayer.utils.OrientationUtils |
13 | -import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer | 20 | +import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer |
14 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity | 21 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity |
15 | 22 | ||
16 | 23 | ||
@@ -24,18 +31,23 @@ class OnlineDetailActivity | @@ -24,18 +31,23 @@ class OnlineDetailActivity | ||
24 | ActivityOnlineDetailBinding::inflate | 31 | ActivityOnlineDetailBinding::inflate |
25 | ) { | 32 | ) { |
26 | 33 | ||
27 | - var orientationUtils: OrientationUtils ? =null | 34 | + |
28 | override fun initDataObserver() { | 35 | override fun initDataObserver() { |
29 | 36 | ||
30 | } | 37 | } |
31 | 38 | ||
32 | - var isPlay : Boolean = false | ||
33 | - var isPause : Boolean = false | ||
34 | 39 | ||
35 | override fun initData() { | 40 | override fun initData() { |
36 | super.initData() | 41 | super.initData() |
37 | - | ||
38 | binding.apply { | 42 | binding.apply { |
43 | + videoPlayer.initVideoBuilderMode( | ||
44 | + "", | ||
45 | + "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4", | ||
46 | + this@OnlineDetailActivity, | ||
47 | + lifecycle | ||
48 | + ) | ||
49 | + videoPlayer.titleTextView.visibility = View.GONE | ||
50 | + videoPlayer.backButton.visibility = View.GONE | ||
39 | 51 | ||
40 | val searchResultAdapter = BasePagerAdapter( | 52 | val searchResultAdapter = BasePagerAdapter( |
41 | supportFragmentManager, | 53 | supportFragmentManager, |
@@ -49,62 +61,23 @@ class OnlineDetailActivity | @@ -49,62 +61,23 @@ class OnlineDetailActivity | ||
49 | viewPager.adapter = searchResultAdapter | 61 | viewPager.adapter = searchResultAdapter |
50 | tabLayout.setupWithViewPager(viewPager) | 62 | tabLayout.setupWithViewPager(viewPager) |
51 | 63 | ||
52 | - | ||
53 | - initOrientationUtils(videoPlayer, false) | ||
54 | - val source1 = | ||
55 | - "http://9890.vod.myqcloud.com/9890_4e292f9a3dd011e6b4078980237cc3d3.f20.mp4" | ||
56 | - videoPlayer.setUp(source1, true, "测试视频") | ||
57 | - videoPlayer.backButton.visibility = View.GONE | ||
58 | - videoPlayer.startButton.setOnClickListener { | ||
59 | - videoPlayer.startPlayLogic() | ||
60 | } | 64 | } |
61 | 65 | ||
62 | - videoPlayer.fullscreenButton.setOnClickListener { | ||
63 | -// orientationUtils!!.resolveByClick() | ||
64 | - videoPlayer.startWindowFullscreen(this@OnlineDetailActivity,true,true) | ||
65 | } | 66 | } |
66 | 67 | ||
67 | - } | ||
68 | 68 | ||
69 | + override fun onBackPressed() { | ||
70 | + binding.videoPlayer.onBackPressed() | ||
71 | + if (GSYVideoManager.backFromWindowFull(this)) { | ||
72 | + return | ||
69 | } | 73 | } |
70 | - | ||
71 | - private fun initOrientationUtils(videoPlayer: StandardGSYVideoPlayer, full: Boolean) { | ||
72 | - orientationUtils = OrientationUtils(this, videoPlayer) | ||
73 | - //是否需要跟随系统旋转设置 | ||
74 | - //orientationUtils.setRotateWithSystem(false); | ||
75 | - orientationUtils!!.isLand = if (full) 1 else 0 | ||
76 | - } | ||
77 | - | ||
78 | - override fun onPause() { | ||
79 | - super.onPause() | ||
80 | - binding.videoPlayer.onVideoPause() | ||
81 | - } | ||
82 | - | ||
83 | - override fun onResume() { | ||
84 | - super.onResume() | ||
85 | - binding.videoPlayer.onVideoResume() | ||
86 | - } | ||
87 | - | ||
88 | - override fun onDestroy() { | ||
89 | - GSYVideoManager.releaseAllVideos(); | ||
90 | - if (orientationUtils != null) | ||
91 | - orientationUtils!!.releaseListener(); | ||
92 | - super.onDestroy() | ||
93 | - | 74 | + super.onBackPressed() |
94 | } | 75 | } |
95 | 76 | ||
96 | override fun onConfigurationChanged(newConfig: Configuration) { | 77 | override fun onConfigurationChanged(newConfig: Configuration) { |
97 | super.onConfigurationChanged(newConfig) | 78 | super.onConfigurationChanged(newConfig) |
98 | //如果旋转了就全屏 | 79 | //如果旋转了就全屏 |
99 | -// if (isPlay && !isPause) { | ||
100 | - binding.videoPlayer.onConfigurationChanged( | ||
101 | - this, | ||
102 | - newConfig, | ||
103 | - orientationUtils, | ||
104 | - true, | ||
105 | - true | ||
106 | - ); | ||
107 | -// } | ||
108 | - | 80 | + binding.videoPlayer.onConfigurationChanged(newConfig, this) |
109 | } | 81 | } |
82 | + | ||
110 | } | 83 | } |
@@ -19,6 +19,7 @@ class WebViewActivity : AppCompatActivity() { | @@ -19,6 +19,7 @@ class WebViewActivity : AppCompatActivity() { | ||
19 | setContentView(R.layout.activity_web) | 19 | setContentView(R.layout.activity_web) |
20 | val webView: WebView = findViewById(R.id.web_view) | 20 | val webView: WebView = findViewById(R.id.web_view) |
21 | webView.loadUrl("file:///android_asset/index.html?"+"http://www.tjxqda.com/cms/picture/8697695a-b8a6-4379-b89e-85c11fd127e2.pdf") | 21 | webView.loadUrl("file:///android_asset/index.html?"+"http://www.tjxqda.com/cms/picture/8697695a-b8a6-4379-b89e-85c11fd127e2.pdf") |
22 | +// webView.loadUrl("http://static.bszh.com/js/pdf/web/viewer.html?file"+"http://www.tjxqda.com/cms/picture/8697695a-b8a6-4379-b89e-85c11fd127e2.pdf") | ||
22 | webView.webViewClient=object :WebViewClient(){ | 23 | webView.webViewClient=object :WebViewClient(){ |
23 | override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { | 24 | override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean { |
24 | view.loadUrl(url) | 25 | view.loadUrl(url) |
1 | package com.br_technology.securitytrain_master.ui.home.fragment | 1 | package com.br_technology.securitytrain_master.ui.home.fragment |
2 | 2 | ||
3 | -import android.view.View | ||
4 | -import androidx.core.content.ContextCompat | ||
5 | import com.br_technology.securitytrain_master.R | 3 | import com.br_technology.securitytrain_master.R |
6 | import com.br_technology.securitytrain_master.databinding.FragmentOnliveCourseBinding | 4 | import com.br_technology.securitytrain_master.databinding.FragmentOnliveCourseBinding |
7 | import com.br_technology.securitytrain_master.expand.addItemDecoration2 | 5 | import com.br_technology.securitytrain_master.expand.addItemDecoration2 |
@@ -10,7 +8,6 @@ import com.br_technology.securitytrain_master.ui.home.adapter.VideoCourseAdapter | @@ -10,7 +8,6 @@ import com.br_technology.securitytrain_master.ui.home.adapter.VideoCourseAdapter | ||
10 | import com.br_technology.securitytrain_master.ui.home.pojo.VideoCourse | 8 | import com.br_technology.securitytrain_master.ui.home.pojo.VideoCourse |
11 | import com.br_technology.securitytrain_master.ui.home.viewmodel.OnLiveCourseFragmentViewModel | 9 | import com.br_technology.securitytrain_master.ui.home.viewmodel.OnLiveCourseFragmentViewModel |
12 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener | 10 | import com.br_technology.securitytrain_master.view.listener.OnItemClickListener |
13 | -import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener | ||
14 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment | 11 | import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment |
15 | 12 | ||
16 | /** | 13 | /** |
1 | +package com.br_technology.securitytrain_master.view | ||
2 | + | ||
3 | +import android.app.Activity | ||
4 | +import android.content.Context | ||
5 | +import android.content.res.Configuration | ||
6 | +import android.text.TextUtils | ||
7 | +import android.util.AttributeSet | ||
8 | +import android.widget.ImageView | ||
9 | +import androidx.lifecycle.Lifecycle | ||
10 | +import androidx.lifecycle.LifecycleObserver | ||
11 | +import androidx.lifecycle.OnLifecycleEvent | ||
12 | +import com.br_technology.securitytrain_master.R | ||
13 | +import com.br_technology.securitytrain_master.expand.loadPic | ||
14 | +import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder | ||
15 | +import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack | ||
16 | +import com.shuyu.gsyvideoplayer.utils.OrientationUtils | ||
17 | +import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer | ||
18 | + | ||
19 | +/** | ||
20 | + * createTime:2021/8/2 8:57 | ||
21 | + * auth:张继 | ||
22 | + * des: | ||
23 | + */ | ||
24 | +class MyVideoPlayer : StandardGSYVideoPlayer,LifecycleObserver { | ||
25 | + private var isPlay = false | ||
26 | + | ||
27 | + private var isPause = false | ||
28 | + | ||
29 | + private var orientationUtils: OrientationUtils? = null | ||
30 | + | ||
31 | + constructor(context: Context) : super(context) | ||
32 | + constructor(context: Context, fullFlag: Boolean) : super(context, fullFlag) | ||
33 | + constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) | ||
34 | + | ||
35 | + | ||
36 | + override fun getLayoutId(): Int { | ||
37 | + return R.layout.layout_video_player | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | + /** | ||
42 | + * 选择普通模式 | ||
43 | + */ | ||
44 | + private fun initVideo(activity: Activity) { | ||
45 | + //外部辅助的旋转,帮助全屏 | ||
46 | + orientationUtils = OrientationUtils(activity, this, orientationOption) | ||
47 | + //初始化不打开外部的旋转 | ||
48 | + orientationUtils!!.isEnable = false | ||
49 | + if (this.fullscreenButton != null) { | ||
50 | + this.fullscreenButton.setOnClickListener { | ||
51 | + showFull() | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | + private fun showFull() { | ||
57 | + if (orientationUtils!!.isLand != 1) { | ||
58 | + //直接横屏 | ||
59 | + orientationUtils!!.resolveByClick() | ||
60 | + } | ||
61 | + //第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar | ||
62 | + this.startWindowFullscreen( | ||
63 | + context, | ||
64 | + true, | ||
65 | + true | ||
66 | + ) | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 选择builder模式 | ||
71 | + */ | ||
72 | + fun initVideoBuilderMode( | ||
73 | + pic: String, | ||
74 | + mp4: String, | ||
75 | + activity: Activity, | ||
76 | + lifecycle: Lifecycle | ||
77 | + ) { | ||
78 | + // 添加生命周期管理 | ||
79 | + lifecycle.addObserver(this) | ||
80 | + initVideo(activity) | ||
81 | + getGSYVideoOptionBuilder(pic, mp4).setVideoAllCallBack(object : GSYSampleCallBack() { | ||
82 | + override fun onPrepared(url: String?, vararg objects: Any?) { | ||
83 | + super.onPrepared(url, *objects) | ||
84 | + //开始播放了才能旋转和全屏 | ||
85 | + orientationUtils!!.isEnable = true | ||
86 | + isPlay = true | ||
87 | + } | ||
88 | + | ||
89 | + override fun onQuitFullscreen(url: String?, vararg objects: Any?) { | ||
90 | + super.onQuitFullscreen(url, *objects) | ||
91 | + orientationUtils?.backToProtVideo(); | ||
92 | + } | ||
93 | + }).build(this) | ||
94 | + } | ||
95 | + | ||
96 | + private fun getGSYVideoOptionBuilder(pic: String, mp4: String): GSYVideoOptionBuilder { | ||
97 | + val imageView = ImageView(context) | ||
98 | + imageView.scaleType = ImageView.ScaleType.CENTER_CROP | ||
99 | + if (TextUtils.isEmpty(pic)) { | ||
100 | + imageView.setImageResource(R.mipmap.mask) | ||
101 | + }else{ | ||
102 | + // 展位图 | ||
103 | + imageView.loadPic(pic) | ||
104 | + } | ||
105 | + return GSYVideoOptionBuilder() | ||
106 | + .setThumbImageView(imageView) | ||
107 | + .setUrl(mp4) | ||
108 | + .setCacheWithPlay(true) | ||
109 | + .setVideoTitle("") | ||
110 | + .setIsTouchWiget(true) | ||
111 | + .setRotateViewAuto(false) | ||
112 | + .setLockLand(false) | ||
113 | + .setShowFullAnimation(false)//打开动画 | ||
114 | + .setNeedLockFull(true) | ||
115 | + .setSeekRatio(1f) | ||
116 | + | ||
117 | + } | ||
118 | + | ||
119 | + @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) | ||
120 | + private fun onResume() { | ||
121 | + this.currentPlayer.onVideoResume(false) | ||
122 | + isPause = false | ||
123 | + } | ||
124 | + | ||
125 | + @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) | ||
126 | + private fun onPause() { | ||
127 | + this.currentPlayer.onVideoPause() | ||
128 | + isPause = true | ||
129 | + } | ||
130 | + | ||
131 | + @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) | ||
132 | + private fun onDestroy() { | ||
133 | + if (isPlay) { | ||
134 | + this.currentPlayer.release() | ||
135 | + } | ||
136 | + if (orientationUtils != null) orientationUtils!!.releaseListener() | ||
137 | + } | ||
138 | + | ||
139 | + fun onBackPressed() { | ||
140 | + if (orientationUtils != null) { | ||
141 | + orientationUtils!!.backToProtVideo() | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + | ||
146 | + fun onConfigurationChanged(newConfig: Configuration, activity: Activity) { | ||
147 | + //如果旋转了就全屏 | ||
148 | + if (isPlay && !isPause) { | ||
149 | + this.onConfigurationChanged( | ||
150 | + activity, | ||
151 | + newConfig, | ||
152 | + orientationUtils, | ||
153 | + true, | ||
154 | + true | ||
155 | + ) | ||
156 | + } | ||
157 | + } | ||
158 | +} |
@@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable | @@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable | ||
6 | import android.util.AttributeSet | 6 | import android.util.AttributeSet |
7 | import android.view.LayoutInflater | 7 | import android.view.LayoutInflater |
8 | import android.widget.RelativeLayout | 8 | import android.widget.RelativeLayout |
9 | +import androidx.appcompat.widget.Toolbar | ||
9 | import com.br_technology.securitytrain_master.R | 10 | import com.br_technology.securitytrain_master.R |
10 | import com.br_technology.securitytrain_master.databinding.BarToolViewBinding | 11 | import com.br_technology.securitytrain_master.databinding.BarToolViewBinding |
11 | import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener | 12 | import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener |
@@ -52,25 +52,12 @@ | @@ -52,25 +52,12 @@ | ||
52 | android:textColor="@color/color_32" | 52 | android:textColor="@color/color_32" |
53 | android:textSize="17sp" /> | 53 | android:textSize="17sp" /> |
54 | 54 | ||
55 | - <FrameLayout | 55 | + <com.br_technology.securitytrain_master.view.MyVideoPlayer |
56 | + android:id="@+id/video_player" | ||
56 | android:layout_width="match_parent" | 57 | android:layout_width="match_parent" |
57 | - android:layout_height="wrap_content" | ||
58 | - android:layout_gravity="center" | 58 | + android:layout_height="192dp" |
59 | android:layout_marginStart="16dp" | 59 | android:layout_marginStart="16dp" |
60 | - android:layout_marginEnd="16dp"> | ||
61 | - | ||
62 | - <ImageView | ||
63 | - android:layout_width="match_parent" | ||
64 | - android:layout_height="match_parent" | ||
65 | - android:scaleType="centerCrop" | ||
66 | - android:src="@mipmap/mask" /> | ||
67 | - | ||
68 | - <ImageView | ||
69 | - android:layout_width="wrap_content" | ||
70 | - android:layout_height="wrap_content" | ||
71 | - android:layout_gravity="center" | ||
72 | - android:src="@mipmap/paly" /> | ||
73 | - </FrameLayout> | 60 | + android:layout_marginEnd="16dp" /> |
74 | 61 | ||
75 | <androidx.core.widget.NestedScrollView | 62 | <androidx.core.widget.NestedScrollView |
76 | android:layout_width="match_parent" | 63 | android:layout_width="match_parent" |
@@ -90,8 +77,8 @@ | @@ -90,8 +77,8 @@ | ||
90 | android:layout_width="match_parent" | 77 | android:layout_width="match_parent" |
91 | android:layout_height="wrap_content" | 78 | android:layout_height="wrap_content" |
92 | android:layout_marginTop="24dp" | 79 | android:layout_marginTop="24dp" |
93 | - android:scrollbars="none" | ||
94 | - android:layout_marginBottom="40dp" /> | 80 | + android:layout_marginBottom="40dp" |
81 | + android:scrollbars="none" /> | ||
95 | 82 | ||
96 | <androidx.recyclerview.widget.RecyclerView | 83 | <androidx.recyclerview.widget.RecyclerView |
97 | android:id="@+id/pdf" | 84 | android:id="@+id/pdf" |
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | android:layout_width="match_parent" | 4 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 5 | android:layout_height="match_parent" |
@@ -11,23 +11,22 @@ | @@ -11,23 +11,22 @@ | ||
11 | android:id="@+id/tool_bar" | 11 | android:id="@+id/tool_bar" |
12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
13 | android:layout_height="wrap_content" | 13 | android:layout_height="wrap_content" |
14 | + android:layout_below="@id/status_bar" | ||
15 | + android:visibility="visible" | ||
14 | app:toolTitle="课程详情" /> | 16 | app:toolTitle="课程详情" /> |
15 | 17 | ||
16 | - <LinearLayout | ||
17 | - android:layout_width="match_parent" | ||
18 | - android:layout_height="match_parent" | ||
19 | - android:orientation="vertical"> | ||
20 | - | ||
21 | - <com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer | 18 | + <com.br_technology.securitytrain_master.view.MyVideoPlayer |
22 | android:id="@+id/video_player" | 19 | android:id="@+id/video_player" |
23 | android:layout_width="match_parent" | 20 | android:layout_width="match_parent" |
24 | - android:layout_height="210dp" /> | 21 | + android:layout_height="210dp" |
22 | + android:layout_below="@id/tool_bar" /> | ||
25 | 23 | ||
26 | <com.google.android.material.tabs.TabLayout | 24 | <com.google.android.material.tabs.TabLayout |
27 | android:id="@+id/tab_layout" | 25 | android:id="@+id/tab_layout" |
28 | style="@style/SearchTab" | 26 | style="@style/SearchTab" |
29 | android:layout_width="match_parent" | 27 | android:layout_width="match_parent" |
30 | android:layout_height="?actionBarSize" | 28 | android:layout_height="?actionBarSize" |
29 | + android:layout_below="@id/video_player" | ||
31 | android:overScrollMode="never" | 30 | android:overScrollMode="never" |
32 | app:tabMode="auto" | 31 | app:tabMode="auto" |
33 | app:tabSelectedTextColor="@color/color_252" | 32 | app:tabSelectedTextColor="@color/color_252" |
@@ -36,7 +35,7 @@ | @@ -36,7 +35,7 @@ | ||
36 | <androidx.viewpager.widget.ViewPager | 35 | <androidx.viewpager.widget.ViewPager |
37 | android:id="@+id/view_pager" | 36 | android:id="@+id/view_pager" |
38 | android:layout_width="match_parent" | 37 | android:layout_width="match_parent" |
39 | - android:layout_height="wrap_content" /> | 38 | + android:layout_height="wrap_content" |
39 | + android:layout_below="@id/tab_layout" /> | ||
40 | 40 | ||
41 | - </LinearLayout> | ||
42 | -</LinearLayout> | ||
41 | +</RelativeLayout> |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + android:layout_width="match_parent" | ||
4 | + android:layout_height="match_parent" | ||
5 | + android:background="@android:color/black"> | ||
6 | + | ||
7 | + <RelativeLayout | ||
8 | + android:id="@+id/surface_container" | ||
9 | + android:layout_width="match_parent" | ||
10 | + android:layout_height="match_parent" | ||
11 | + android:gravity="center"> | ||
12 | + | ||
13 | + </RelativeLayout> | ||
14 | + | ||
15 | + <RelativeLayout | ||
16 | + android:id="@+id/thumb" | ||
17 | + android:layout_width="match_parent" | ||
18 | + android:layout_height="match_parent" | ||
19 | + android:layout_alignParentStart="true" | ||
20 | + android:layout_alignParentLeft="true" | ||
21 | + android:layout_alignParentTop="true" | ||
22 | + android:layout_alignParentEnd="true" | ||
23 | + android:layout_alignParentRight="true" | ||
24 | + android:layout_alignParentBottom="true" | ||
25 | + android:background="#000000" | ||
26 | + android:scaleType="fitCenter" /> | ||
27 | + | ||
28 | + <LinearLayout | ||
29 | + android:id="@+id/layout_bottom" | ||
30 | + android:layout_width="match_parent" | ||
31 | + android:layout_height="40dp" | ||
32 | + android:layout_alignParentBottom="true" | ||
33 | + android:background="#99000000" | ||
34 | + android:gravity="center_vertical" | ||
35 | + android:orientation="horizontal" | ||
36 | + android:visibility="invisible"> | ||
37 | + | ||
38 | + <TextView | ||
39 | + android:id="@+id/current" | ||
40 | + android:layout_width="wrap_content" | ||
41 | + android:layout_height="wrap_content" | ||
42 | + android:layout_marginLeft="16dp" | ||
43 | + android:text="00:00" | ||
44 | + android:textColor="#ffffff" /> | ||
45 | + | ||
46 | + <SeekBar | ||
47 | + android:id="@+id/progress" | ||
48 | + android:layout_width="0dp" | ||
49 | + android:layout_height="wrap_content" | ||
50 | + android:layout_gravity="center_vertical" | ||
51 | + android:layout_weight="1.0" | ||
52 | + android:background="@null" | ||
53 | + android:max="100" | ||
54 | + android:maxHeight="4dp" | ||
55 | + android:minHeight="4dp" | ||
56 | + android:paddingTop="8dp" | ||
57 | + android:paddingBottom="8dp" | ||
58 | + android:progressDrawable="@drawable/video_seek_progress" | ||
59 | + android:thumb="@drawable/video_seek_thumb" /> | ||
60 | + | ||
61 | + <TextView | ||
62 | + android:id="@+id/total" | ||
63 | + android:layout_width="wrap_content" | ||
64 | + android:layout_height="wrap_content" | ||
65 | + android:layout_marginRight="16dp" | ||
66 | + android:text="00:00" | ||
67 | + android:textColor="#ffffff" /> | ||
68 | + | ||
69 | + <ImageView | ||
70 | + android:id="@+id/fullscreen" | ||
71 | + android:layout_width="wrap_content" | ||
72 | + android:layout_height="fill_parent" | ||
73 | + android:paddingRight="16dp" | ||
74 | + android:scaleType="center" | ||
75 | + android:src="@drawable/video_enlarge" /> | ||
76 | + </LinearLayout> | ||
77 | + | ||
78 | + <ProgressBar | ||
79 | + android:id="@+id/bottom_progressbar" | ||
80 | + style="?android:attr/progressBarStyleHorizontal" | ||
81 | + android:layout_width="match_parent" | ||
82 | + android:layout_height="1.5dp" | ||
83 | + android:layout_alignParentBottom="true" | ||
84 | + android:max="100" | ||
85 | + android:progressDrawable="@drawable/video_progress" /> | ||
86 | + | ||
87 | + <ImageView | ||
88 | + android:id="@+id/back_tiny" | ||
89 | + android:layout_width="24dp" | ||
90 | + android:layout_height="24dp" | ||
91 | + android:layout_marginLeft="6dp" | ||
92 | + android:layout_marginTop="6dp" | ||
93 | + android:visibility="gone" /> | ||
94 | + | ||
95 | + <LinearLayout | ||
96 | + android:id="@+id/layout_top" | ||
97 | + android:layout_width="match_parent" | ||
98 | + android:layout_height="48dp" | ||
99 | + android:background="@drawable/video_title_bg" | ||
100 | + android:gravity="center_vertical"> | ||
101 | + | ||
102 | + <ImageView | ||
103 | + android:id="@+id/back" | ||
104 | + android:layout_width="48dp" | ||
105 | + android:layout_height="48dp" | ||
106 | + android:paddingLeft="10dp" | ||
107 | + android:scaleType="centerInside" | ||
108 | + android:src="@drawable/video_back" /> | ||
109 | + | ||
110 | + <TextView | ||
111 | + android:id="@+id/title" | ||
112 | + android:layout_width="wrap_content" | ||
113 | + android:layout_height="wrap_content" | ||
114 | + android:paddingLeft="10dp" | ||
115 | + android:textColor="@android:color/white" | ||
116 | + android:textSize="18sp" /> | ||
117 | + </LinearLayout> | ||
118 | + | ||
119 | + | ||
120 | + <ProgressBar | ||
121 | + android:id="@+id/loading" | ||
122 | + style="?android:attr/progressBarStyleLarge" | ||
123 | + android:layout_width="28dp" | ||
124 | + android:layout_height="28dp" | ||
125 | + android:layout_centerHorizontal="true" | ||
126 | + android:layout_centerVertical="true" | ||
127 | + android:visibility="invisible" /> | ||
128 | + | ||
129 | + <ImageView | ||
130 | + android:id="@+id/start" | ||
131 | + android:layout_width="60dp" | ||
132 | + android:layout_height="60dp" | ||
133 | + android:layout_centerHorizontal="true" | ||
134 | + android:layout_centerVertical="true" | ||
135 | + android:layout_gravity="center_vertical" | ||
136 | + android:src="@mipmap/play" /> | ||
137 | + | ||
138 | + | ||
139 | + <ImageView | ||
140 | + android:id="@+id/small_close" | ||
141 | + android:layout_width="30dp" | ||
142 | + android:layout_height="30dp" | ||
143 | + android:paddingLeft="10dp" | ||
144 | + android:paddingTop="10dp" | ||
145 | + android:scaleType="centerInside" | ||
146 | + android:src="@drawable/video_small_close" | ||
147 | + android:visibility="gone" /> | ||
148 | + | ||
149 | + <ImageView | ||
150 | + android:id="@+id/lock_screen" | ||
151 | + android:layout_width="30dp" | ||
152 | + android:layout_height="30dp" | ||
153 | + android:layout_alignParentRight="true" | ||
154 | + android:layout_centerVertical="true" | ||
155 | + android:layout_marginRight="50dp" | ||
156 | + android:scaleType="centerInside" | ||
157 | + android:src="@drawable/unlock" | ||
158 | + android:visibility="gone" /> | ||
159 | + | ||
160 | +</RelativeLayout> |
-
请 注册 或 登录 后发表评论