作者 刘纪龙

Loong:bug

... ... @@ -4,22 +4,34 @@
<option name="filePathToZoomLevelMap">
<map>
<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" />
<entry key="../../../../../layout/custom_preview.xml" value="0.2890625" />
<entry key="../../../Library/Android/sdk/platforms/android-30/data/res/layout/auto_complete_list.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_account_login.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_answer_record_details.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_answer_sheet.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_class_duty.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_database_detail.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_mobile_login.xml" value="0.2462962962962963" />
<entry key="app/src/main/res/layout/activity_offline_exercise.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_online.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_online_detail.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_practice.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_splash.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_video_detail.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/activity_web.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/adapter_content_practice_item.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/adapter_topic.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/adapter_video_course.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/dialog_check_id.xml" value="0.33" />
<entry key="app/src/main/res/layout/dialog_class_list.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/fragment_bank.xml" value="0.33" />
<entry key="app/src/main/res/layout/fragment_class_duty_course.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/fragment_course_list.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/item_course.xml" value="0.22552083333333334" />
<entry key="app/src/main/res/layout/item_course_off.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/item_course_section.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/item_course_video.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/item_mock_examnation.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/item_special_exercises.xml" value="0.2671875" />
<entry key="app/src/main/res/layout/layout_loading.xml" value="0.2671875" />
... ...
... ... @@ -7,7 +7,21 @@ plugins {
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
signingConfigs {
release {
keyAlias 'key0'
keyPassword '123456'
storeFile file('../security.jks')
storePassword '123456'
}
debug {
keyAlias 'key0'
keyPassword '123456'
storeFile file('../security.jks')
storePassword '123456'
}
}
defaultConfig {
applicationId "com.br_technology.securitytrain_master"
minSdkVersion 21
... ... @@ -18,7 +32,11 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
//设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so)
// abiFilters /*"armeabi", "armeabi-v7a",*/ "arm64-v8a"
}
}
aaptOptions {
// // aapt 附加参数
... ... @@ -156,4 +174,8 @@ dependencies {
implementation 'com.umeng.umsdk:common:9.4.4'
implementation 'com.umeng.umsdk:asms:1.4.1'
implementation 'com.umeng.umsdk:apm:1.5.2'
//下拉加载上拉刷新SmartRefresh
implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' //核心必须依赖
implementation 'com.scwang.smart:refresh-header-classics:2.0.3' //经典刷新头
implementation 'com.scwang.smart:refresh-footer-classics:2.0.3' //经典加载
}
\ No newline at end of file
... ...
... ... @@ -56,10 +56,12 @@ open class BaseApplication : Application() {
})
val needDownload = TbsDownloader.needDownload(this, TbsDownloader.DOWNLOAD_OVERSEA_TBS);
if (needDownload) {
TbsDownloader.startDownload(this);
TbsDownloader.startDownload(this)
}
initUmeng()
PlayerFactory.setPlayManager(Exo2PlayerManager::class.java)
SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout -> ClassicsHeader(context) }
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout -> ClassicsFooter(context) }
}
fun initUmeng() {
... ...
... ... @@ -2,6 +2,7 @@ package com.br_technology.securitytrain_master.ui.view.home.activity
import android.content.Intent
import android.content.res.Configuration
import android.content.res.Resources
import android.os.Bundle
import android.text.TextUtils
import android.view.View
... ... @@ -38,11 +39,15 @@ class DatabaseDetailActivity :
videoPlayer.apply {
setFullOnClick{
if(!it) {
binding.title.visibility = View.GONE
binding.toolBar.visibility = View.GONE
binding.inTitle.root.visibility = View.GONE
binding.li.setPadding(0,0,0,0)
}else{
binding.title.visibility = View.VISIBLE
binding.toolBar.visibility= View.VISIBLE
binding.inTitle.root.visibility= View.VISIBLE
binding.li.setPadding(dp2px(16),0,dp2px(16),0)
ImmersionBar.with(this@DatabaseDetailActivity).transparentStatusBar().statusBarDarkFont(true).init()
}}
}
... ... @@ -53,6 +58,8 @@ class DatabaseDetailActivity :
}
}
}
private fun dp2px(i: Int): Int {
return (Resources.getSystem().displayMetrics.density * i + 0.5f).toInt()}
override fun initDataObserver() {
mViewModel.collectResponse.observe(this, {
... ...
... ... @@ -3,6 +3,7 @@ package com.br_technology.securitytrain_master.ui.view.home.activity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.core.content.ContextCompat
import com.br_technology.securitytrain_master.R
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
... ... @@ -21,6 +22,7 @@ import com.br_technology.securitytrain_master.util.sp_job_name_select
import com.br_technology.securitytrain_master.view.ClassifyPop
import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener
import com.chad.library.adapter.base.listener.OnLoadMoreListener
import com.luck.picture.lib.tools.ToastUtils
import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
/**
... ... @@ -72,9 +74,9 @@ class OnlineActivity :
VideoCourseAdapter(R.layout.adapter_video_course, videoLessonList)
videoLessonList = mutableListOf()
onlineRecycler.adapter = videoCourseAdapter
videoCourseAdapter?.setOnItemClickListener { adapter, view, position ->
videoCourseAdapter?.setOnClick{
val course = CourseParam()
val data = videoLessonList!![position]
val data = it
course.mLessonId = "${data.id}"
course.isTrainClass = false
course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO
... ... @@ -86,30 +88,72 @@ class OnlineActivity :
.putExtra(ConstantParamKey.COURSE_LESSON, data)
)
}
videoCourseAdapter?.setOnItemClickListener { adapter, view, position ->
val course = CourseParam()
if(videoLessonList?.size!! > position+1){
val data = videoLessonList!![position]
course.mLessonId = "${data.id}"
course.isTrainClass = false
course.type = TrainCourseDetailItemType.TYPE_COURSE_DETAIL_ITEM_VIDEO
startActivity(
Intent(
this@OnlineActivity,
CourseDetailActivity::class.java
).putExtra(ConstantParamKey.COURSE_BEAN, course)
.putExtra(ConstantParamKey.COURSE_LESSON, data)
)
}else{
Toast.makeText(this@OnlineActivity,"暂无视频",Toast.LENGTH_SHORT).show()
}
}
initLoadMore()
swipeRefreshlayout.setOnRefreshListener {
videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = false
// swipeRefreshlayout.setOnRefreshListener {
// videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = false
// page = 1
// loadData()
// }
initRefresh()
}
}
/**
* 加载刷新
*/
private fun initRefresh() {
binding.srBottle.apply {
setEnableAutoLoadMore(true)
setOnRefreshListener {
page = 1
loadData()
}
setOnLoadMoreListener {
page += 1
loadData()
}
}
}
override fun initDataObserver() {
mViewModel.mVideoLessonBean.observe(this, {
binding.swipeRefreshlayout.isRefreshing = false
videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = !(it.data.list.data.size < 10)
if(it.code==1){
// videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = !(it.data.list.data.size < 10)
videoLessonList?.clear()
videoLessonList?.addAll(it.data.list.data)
videoLessonList?.clear()
videoLessonList?.addAll(it.data.list.data)
if (page == 1) {
videoCourseAdapter?.setList(videoLessonList)
} else {
videoLessonList?.let { it1 -> videoCourseAdapter?.addData(it1) }
if (page == 1) {
videoCourseAdapter?.setList(videoLessonList)
} else {
videoLessonList?.let { it1 -> videoCourseAdapter?.addData(it1) }
}
binding.srBottle.finishRefresh(true)
binding.srBottle.finishLoadMore(true)
}else{
binding.srBottle.finishRefresh(false)
binding.srBottle.finishLoadMore(false)
}
++page
// binding.swipeRefreshlayout.isRefreshing = false
// ++page
})
mViewModel.mWorkTypeBean.observe(this, {
classifyPop.setList(it.data.list)
... ... @@ -124,13 +168,13 @@ class OnlineActivity :
}
fun initLoadMore() {
videoCourseAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
override fun onLoadMore() {
binding.swipeRefreshlayout.isRefreshing = false
loadData()
}
})
videoCourseAdapter?.loadMoreModule?.isAutoLoadMore = true
videoCourseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
// videoCourseAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
// override fun onLoadMore() {
//// binding.swipeRefreshlayout.isRefreshing = false
// loadData()
// }
// })
// videoCourseAdapter?.loadMoreModule?.isAutoLoadMore = true
// videoCourseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,9 @@ package com.br_technology.securitytrain_master.ui.view.home.activity.course
import android.content.res.Configuration
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.Toast
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.databinding.ActivityVideoDetailBinding
import com.br_technology.securitytrain_master.ui.bean.CourseParam
... ... @@ -26,6 +28,7 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
var courseBean: CourseParam? = null
private var isFinishs:Boolean=false
override fun initDataObserver() {
}
... ... @@ -34,12 +37,18 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
binding.videoPlayer.mStatusChange = object : MyVideoPlayer.IStatusChange {
override fun status(isPause: Boolean, isFinish: Boolean) {
if (!TextUtils.isEmpty(intent.getStringExtra(ConstantParamKey.COMMON_URL))) {
mViewModel.record(timeGet(binding.videoPlayer.getProgressTime()))
val time = timeGet(binding.videoPlayer.getProgressTime())
mViewModel.record(time)
val timeLong= binding.videoPlayer.duration
var timeResult:Double=(time.toDouble()*1000)/timeLong
if(timeResult >=0.8){
isFinishs=true
}
}
if (!isPause && isFinish) {
if (!isPause&&isFinish) {
binding.videoPlayer.setCantTouch(true)
EventBus.getDefault()
.post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true))
// EventBus.getDefault()
// .post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true))
}
}
}
... ... @@ -97,4 +106,12 @@ class VideoDetailActivity : BaseLifeCycleActivity<VideoDetailViewModel, Activity
//如果旋转了就全屏
// binding.videoPlayer.onConfigurationChanged(newConfig, this)
}
override fun onDestroy() {
super.onDestroy()
if(isFinishs){
EventBus.getDefault()
.post(VideoClassChange(mViewModel.courseParam.value?.mLessonId ?: "", true))
}
}
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,11 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder
class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.ListBean.DataBean>?) :
BaseQuickAdapter<VideoLessonBean.ListBean.DataBean, BaseViewHolder>(layoutResId, data),
LoadMoreModule {
private var onClickListener: ((data: VideoLessonBean.ListBean.DataBean) -> Unit?)? = null
fun setOnClick(listener: ( data: VideoLessonBean.ListBean.DataBean) -> Unit){
onClickListener = listener
}
override fun convert(holder: BaseViewHolder, item: VideoLessonBean.ListBean.DataBean) {
// 视频首贞图片
... ... @@ -27,7 +32,7 @@ class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.Lis
holder.setText(R.id.lesson, item.class_hours.toString() + "课时")
// 视频名称
holder.setText(R.id.course_name, item.name)
val teacher = item.teacher;
val teacher = item.teacher
Glide.with(context)
.load(
if (teacher == null) {
... ... @@ -45,6 +50,8 @@ class VideoCourseAdapter(layoutResId: Int, data: MutableList<VideoLessonBean.Lis
teacher.name
}
)
holder.itemView.setOnClickListener {
onClickListener?.invoke(item)
}
}
}
\ No newline at end of file
... ...
package com.br_technology.securitytrain_master.ui.view.home.fragment
import android.content.Intent
import android.util.Log
import com.br_technology.securitytrain_master.base.common.ConstantParamKey
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COMMON_URL
import com.br_technology.securitytrain_master.base.common.ConstantParamKey.COURSE_BEAN
... ...
... ... @@ -27,6 +27,7 @@
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:background="@null"
android:inputType="number"
android:digits="1234567890Xx"
android:hint="请输入账号"
android:textColor="@color/black"
... ...
... ... @@ -51,53 +51,58 @@
android:padding="12dp"
android:src="@mipmap/share" />
</LinearLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="12dp"
android:text="课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称"
android:textColor="@color/color_32"
android:textSize="17sp" />
<com.br_technology.securitytrain_master.view.MyVideoPlayer
android:id="@+id/video_player"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/li"
android:layout_width="match_parent"
android:layout_height="192dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" />
android:layout_height="match_parent"
android:paddingHorizontal="16dp"
android:orientation="vertical"
>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:text="课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称课程名称"
android:textColor="@color/color_32"
android:textSize="17sp" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:overScrollMode="never"
android:scrollbars="none">
<com.br_technology.securitytrain_master.view.MyVideoPlayer
android:id="@+id/video_player"
android:layout_width="match_parent"
android:layout_height="192dp" />
<LinearLayout
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="wrap_content"
android:overScrollMode="never"
android:scrollbars="none">
<com.br_technology.securitytrain_master.view.MyWebView
android:id="@+id/web_view"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />
android:layout_height="match_parent"
android:orientation="vertical">
<com.br_technology.securitytrain_master.view.MyWebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pdf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pdf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -13,7 +13,7 @@
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/status_bar"
android:layout_below="@id/in_title"
android:visibility="visible"
app:toolTitle="线下培训" />
... ...
... ... @@ -13,14 +13,17 @@
android:layout_height="wrap_content"
app:toolTitle="在线课程" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp">
<!-- <androidx.swiperefreshlayout.widget.SwipeRefreshLayout-->
<!-- android:id="@+id/swipeRefreshlayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginEnd="16dp">-->
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/sr_bottle"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/online_recycler"
android:layout_width="match_parent"
... ... @@ -31,6 +34,7 @@
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<!-- </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>-->
</LinearLayout>
\ No newline at end of file
... ...