作者 杨谦

1.部分ui显示功能缺失添加

2.部分ui显示样式修改
todo:剩余问题处理
正在显示 20 个修改的文件 包含 180 行增加154 行删除
@@ -9,8 +9,8 @@ import java.io.File @@ -9,8 +9,8 @@ import java.io.File
9 * Description: 初见时你很迷人 9 * Description: 初见时你很迷人
10 */ 10 */
11 object Constant { 11 object Constant {
12 - const val BASE_URL = "https://admin.anqixing.com"  
13 -// const val BASE_URL = "https://test.admin.anqixing.com" 12 +// const val BASE_URL = "https://admin.anqixing.com"
  13 + const val BASE_URL = "https://test.admin.anqixing.com"
14 const val USERNAME_KEY = "username" 14 const val USERNAME_KEY = "username"
15 const val USERID_KEY = "userid" 15 const val USERID_KEY = "userid"
16 const val LOGIN_KEY = "login" 16 const val LOGIN_KEY = "login"
1 package com.br_technology.securitytrain_master.ui.view.bank.activity 1 package com.br_technology.securitytrain_master.ui.view.bank.activity
2 2
3 import android.os.Bundle 3 import android.os.Bundle
4 -import android.view.View  
5 -import androidx.core.content.ContextCompat  
6 -import androidx.fragment.app.FragmentPagerAdapter  
7 import com.alibaba.fastjson.JSON 4 import com.alibaba.fastjson.JSON
8 -import com.br_technology.securitytrain_master.R  
9 -import com.br_technology.securitytrain_master.base.view.BasePagerAdapter  
10 import com.br_technology.securitytrain_master.databinding.ActivityMockBinding 5 import com.br_technology.securitytrain_master.databinding.ActivityMockBinding
11 -import com.br_technology.securitytrain_master.ui.bean.PaperListDetail  
12 import com.br_technology.securitytrain_master.ui.view.bank.adapter.MockExamAdapter 6 import com.br_technology.securitytrain_master.ui.view.bank.adapter.MockExamAdapter
13 -import com.br_technology.securitytrain_master.ui.view.bank.fragment.MockExamFragment  
14 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.MockExamViewModel 7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.MockExamViewModel
15 import com.br_technology.securitytrain_master.util.sp_job_name 8 import com.br_technology.securitytrain_master.util.sp_job_name
16 -import com.br_technology.securitytrain_master.view.ClassifyPop  
17 -import com.br_technology.securitytrain_master.view.listener.OnItemClickListener  
18 -import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener  
19 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 9 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
20 10
21 /** 11 /**
@@ -40,21 +30,11 @@ class MockExamActivity : @@ -40,21 +30,11 @@ class MockExamActivity :
40 smartRefresh.autoRefresh() 30 smartRefresh.autoRefresh()
41 // 刷新回调函数 31 // 刷新回调函数
42 smartRefresh.setOnRefreshListener { 32 smartRefresh.setOnRefreshListener {
43 - // 初始化页码为1  
44 - page = 1  
45 - // 请求接口  
46 - mViewModel.specialPracticeList(page)  
47 - // 完成刷新  
48 - smartRefresh.finishRefresh() 33 + refresh()
49 } 34 }
50 // 加载回调函数 35 // 加载回调函数
51 smartRefresh.setOnLoadMoreListener { 36 smartRefresh.setOnLoadMoreListener {
52 - // 页码自动加1  
53 - ++page  
54 - // 请求接口  
55 - mViewModel.specialPracticeList(page)  
56 - // 完成加载  
57 - smartRefresh.finishLoadMore() 37 + loadMore()
58 } 38 }
59 // 适配器item点击函数 39 // 适配器item点击函数
60 mockExamAdapter.setOnItemClickListener { _, _, position -> 40 mockExamAdapter.setOnItemClickListener { _, _, position ->
@@ -64,11 +44,24 @@ class MockExamActivity : @@ -64,11 +44,24 @@ class MockExamActivity :
64 } 44 }
65 // 设置列表适配器 45 // 设置列表适配器
66 recycler.adapter = mockExamAdapter 46 recycler.adapter = mockExamAdapter
67 -  
68 } 47 }
69 } 48 }
70 } 49 }
71 50
  51 + private fun refresh(){
  52 + // 初始化页码为1
  53 + page = 1
  54 + // 请求接口
  55 + mViewModel.specialPracticeList(page)
  56 + }
  57 +
  58 + private fun loadMore(){
  59 + // 页码自动加1
  60 + ++page
  61 + // 请求接口
  62 + mViewModel.specialPracticeList(page)
  63 + }
  64 +
72 override fun initDataObserver() { 65 override fun initDataObserver() {
73 // 网络返回数据回调函数 66 // 网络返回数据回调函数
74 mViewModel.liveData.observe(this) { 67 mViewModel.liveData.observe(this) {
@@ -82,6 +75,7 @@ class MockExamActivity : @@ -82,6 +75,7 @@ class MockExamActivity :
82 } else { 75 } else {
83 mockExamAdapter.addData(it.data.list) 76 mockExamAdapter.addData(it.data.list)
84 } 77 }
  78 + binding.smartRefresh.setEnableLoadMore(!(it.data.list.size <= 20))
85 } 79 }
86 80
87 mViewModel.paperDetailLiveData.observe(this) { 81 mViewModel.paperDetailLiveData.observe(this) {
1 package com.br_technology.securitytrain_master.ui.view.bank.activity 1 package com.br_technology.securitytrain_master.ui.view.bank.activity
2 2
3 import android.content.Intent 3 import android.content.Intent
4 -import com.br_technology.securitytrain_master.databinding.ActivityPracticeListBinding  
5 import com.br_technology.securitytrain_master.base.common.ConstantType 4 import com.br_technology.securitytrain_master.base.common.ConstantType
  5 +import com.br_technology.securitytrain_master.databinding.ActivityPracticeListBinding
6 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeListAdapter 6 import com.br_technology.securitytrain_master.ui.view.bank.adapter.PracticeListAdapter
7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel 7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.PracticeViewModel
8 -import com.br_technology.securitytrain_master.util.sp_job_name  
9 import com.luck.picture.lib.tools.ToastUtils 8 import com.luck.picture.lib.tools.ToastUtils
10 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 9 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
11 10
@@ -24,27 +23,17 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr @@ -24,27 +23,17 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr
24 super.initData() 23 super.initData()
25 binding.apply { 24 binding.apply {
26 // 工种 25 // 工种
27 - toolBar.setRightText(sp_job_name) 26 +// toolBar.setRightText(sp_job_name)
28 binding.apply { 27 binding.apply {
29 // 自动刷新 28 // 自动刷新
30 smartRefresh.autoRefresh() 29 smartRefresh.autoRefresh()
31 // 刷新回调函数 30 // 刷新回调函数
32 smartRefresh.setOnRefreshListener { 31 smartRefresh.setOnRefreshListener {
33 - // 初始化页码为1  
34 - page = 1  
35 - // 请求接口  
36 - mViewModel.dayPracticeList(page)  
37 - // 完成刷新  
38 - smartRefresh.finishRefresh() 32 + refresh();
39 } 33 }
40 // 加载回调函数 34 // 加载回调函数
41 smartRefresh.setOnLoadMoreListener { 35 smartRefresh.setOnLoadMoreListener {
42 - // 页码自动加1  
43 - ++page  
44 - // 请求接口  
45 - mViewModel.dayPracticeList(page)  
46 - // 完成加载  
47 - smartRefresh.finishLoadMore() 36 + loadMore()
48 } 37 }
49 // 适配器item点击函数 38 // 适配器item点击函数
50 listAdapter.setOnItemClickListener { _, _, position -> 39 listAdapter.setOnItemClickListener { _, _, position ->
@@ -68,6 +57,25 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr @@ -68,6 +57,25 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr
68 } 57 }
69 } 58 }
70 59
  60 + private fun refresh() {
  61 + // 初始化页码为1
  62 + page = 1
  63 + // 请求接口
  64 + mViewModel.dayPracticeList(page)
  65 + }
  66 +
  67 + private fun loadMore() {
  68 + // 页码自动加1
  69 + ++page
  70 + // 请求接口
  71 + mViewModel.dayPracticeList(page)
  72 + }
  73 +
  74 + override fun onResume() {
  75 + super.onResume()
  76 + refresh()
  77 + }
  78 +
71 override fun initDataObserver() { 79 override fun initDataObserver() {
72 mViewModel.dayPracticeLiveData.observe(this) { 80 mViewModel.dayPracticeLiveData.observe(this) {
73 // 当返回数据<=初始条数时表示没有更多数据 81 // 当返回数据<=初始条数时表示没有更多数据
@@ -80,6 +88,9 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr @@ -80,6 +88,9 @@ class PracticeListActivity : BaseLifeCycleActivity<PracticeViewModel, ActivityPr
80 } else { 88 } else {
81 listAdapter.addData(it.data.list.data) 89 listAdapter.addData(it.data.list.data)
82 } 90 }
  91 + binding.smartRefresh.finishRefresh()
  92 + binding.smartRefresh.finishLoadMore()
  93 + binding.smartRefresh.setEnableLoadMore(!(it.data.list.data.size <= 20))
83 } 94 }
84 } 95 }
85 } 96 }
1 package com.br_technology.securitytrain_master.ui.view.home.activity 1 package com.br_technology.securitytrain_master.ui.view.home.activity
2 2
3 import android.os.Bundle 3 import android.os.Bundle
4 -import android.view.View  
5 -import androidx.core.content.ContextCompat  
6 import androidx.fragment.app.FragmentPagerAdapter 4 import androidx.fragment.app.FragmentPagerAdapter
7 -import com.br_technology.securitytrain_master.R  
8 import com.br_technology.securitytrain_master.base.view.BasePagerAdapter 5 import com.br_technology.securitytrain_master.base.view.BasePagerAdapter
9 import com.br_technology.securitytrain_master.databinding.ActivityLiveCourseBinding 6 import com.br_technology.securitytrain_master.databinding.ActivityLiveCourseBinding
10 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.BankViewModel 7 import com.br_technology.securitytrain_master.ui.view.bank.viewmodel.BankViewModel
@@ -12,9 +9,7 @@ import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEven @@ -12,9 +9,7 @@ import com.br_technology.securitytrain_master.ui.view.home.event.GetWorkTypeEven
12 import com.br_technology.securitytrain_master.ui.view.home.fragment.OnLiveCourseFragment 9 import com.br_technology.securitytrain_master.ui.view.home.fragment.OnLiveCourseFragment
13 import com.br_technology.securitytrain_master.util.TYPE_All 10 import com.br_technology.securitytrain_master.util.TYPE_All
14 import com.br_technology.securitytrain_master.util.TYPE_LIVE 11 import com.br_technology.securitytrain_master.util.TYPE_LIVE
15 -import com.br_technology.securitytrain_master.util.sp_job_name  
16 import com.br_technology.securitytrain_master.view.ClassifyPop 12 import com.br_technology.securitytrain_master.view.ClassifyPop
17 -import com.br_technology.securitytrain_master.view.listener.ToolBarClickListener  
18 import com.google.android.material.tabs.TabLayout 13 import com.google.android.material.tabs.TabLayout
19 import com.gyf.immersionbar.ImmersionBar 14 import com.gyf.immersionbar.ImmersionBar
20 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 15 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
@@ -62,24 +57,24 @@ class LiveCourseActivity @@ -62,24 +57,24 @@ class LiveCourseActivity
62 override fun initData() { 57 override fun initData() {
63 super.initData() 58 super.initData()
64 binding.apply { 59 binding.apply {
65 - toolBar.setRightText(sp_job_name)  
66 - toolBar.setRightTextDrawable(  
67 - ContextCompat.getDrawable(  
68 - baseContext,  
69 - R.mipmap.down_arrow  
70 - )  
71 - )  
72 - toolBar.addRightListener(object : ToolBarClickListener {  
73 - override fun onClick(view: View) {  
74 - if (mViewModel.beanData().value == null) {  
75 - mViewModel.workType()  
76 - } else {  
77 - mViewModel.beanData().value?.apply {  
78 - classifyPop.showAsDropDown(binding.toolBar)  
79 - }  
80 - }  
81 - }  
82 - }) 60 +// toolBar.setRightText(sp_job_name)
  61 +// toolBar.setRightTextDrawable(
  62 +// ContextCompat.getDrawable(
  63 +// baseContext,
  64 +// R.mipmap.down_arrow
  65 +// )
  66 +// )
  67 +// toolBar.addRightListener(object : ToolBarClickListener {
  68 +// override fun onClick(view: View) {
  69 +// if (mViewModel.beanData().value == null) {
  70 +// mViewModel.workType()
  71 +// } else {
  72 +// mViewModel.beanData().value?.apply {
  73 +// classifyPop.showAsDropDown(binding.toolBar)
  74 +// }
  75 +// }
  76 +// }
  77 +// })
83 val searchResultAdapter = BasePagerAdapter( 78 val searchResultAdapter = BasePagerAdapter(
84 supportFragmentManager, 79 supportFragmentManager,
85 FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT 80 FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
@@ -62,7 +62,7 @@ class OnlineActivity : @@ -62,7 +62,7 @@ class OnlineActivity :
62 override fun initDataObserver() { 62 override fun initDataObserver() {
63 mViewModel.mVideoLessonBean.observe(this, { 63 mViewModel.mVideoLessonBean.observe(this, {
64 binding.swipeRefreshlayout.isRefreshing = false 64 binding.swipeRefreshlayout.isRefreshing = false
65 - videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true 65 + videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = !(it.data.list.data.size < 10)
66 66
67 videoLessonList?.clear() 67 videoLessonList?.clear()
68 videoLessonList?.addAll(it.data.list.data) 68 videoLessonList?.addAll(it.data.list.data)
@@ -73,13 +73,13 @@ class OnlineActivity : @@ -73,13 +73,13 @@ class OnlineActivity :
73 videoLessonList?.let { it1 -> videoCourseAdapter?.addData(it1) } 73 videoLessonList?.let { it1 -> videoCourseAdapter?.addData(it1) }
74 } 74 }
75 75
76 - if (it.data.list.data != null) {  
77 - if (it.data.list.data.size < 10) {  
78 - videoCourseAdapter?.loadMoreModule?.loadMoreEnd()  
79 - } else {  
80 - videoCourseAdapter?.loadMoreModule?.loadMoreComplete()  
81 - }  
82 - } 76 +// if (it.data.list.data != null) {
  77 +// if (it.data.list.data.size < 10) {
  78 +// videoCourseAdapter?.loadMoreModule?.loadMoreEnd()
  79 +// } else {
  80 +// videoCourseAdapter?.loadMoreModule?.loadMoreComplete()
  81 +// }
  82 +// }
83 ++page 83 ++page
84 }) 84 })
85 } 85 }
@@ -88,7 +88,7 @@ class OnlineActivity : @@ -88,7 +88,7 @@ class OnlineActivity :
88 videoCourseAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener { 88 videoCourseAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
89 override fun onLoadMore() { 89 override fun onLoadMore() {
90 binding.swipeRefreshlayout.isRefreshing = false 90 binding.swipeRefreshlayout.isRefreshing = false
91 - videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true 91 +// videoCourseAdapter?.loadMoreModule?.isEnableLoadMore = true
92 mViewModel.videoLessons(1, "", page) 92 mViewModel.videoLessons(1, "", page)
93 } 93 }
94 94
@@ -10,7 +10,6 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextD @@ -10,7 +10,6 @@ import com.br_technology.securitytrain_master.ui.view.home.activity.course.TextD
10 import com.br_technology.securitytrain_master.ui.view.home.adapter.TextLessonsAdapter 10 import com.br_technology.securitytrain_master.ui.view.home.adapter.TextLessonsAdapter
11 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean 11 import com.br_technology.securitytrain_master.ui.view.home.bean.TextLessonBean
12 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextCourseViewModel 12 import com.br_technology.securitytrain_master.ui.view.home.viewmodel.TextCourseViewModel
13 -import com.chad.library.adapter.base.listener.OnLoadMoreListener  
14 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 13 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
15 14
16 15
@@ -29,16 +28,16 @@ class TextCourseActivity : @@ -29,16 +28,16 @@ class TextCourseActivity :
29 mViewModel.textLessons("", page) 28 mViewModel.textLessons("", page)
30 29
31 binding.apply { 30 binding.apply {
32 -  
33 initAdapter() 31 initAdapter()
34 -  
35 initLoadMore() 32 initLoadMore()
36 -  
37 swipeRefreshlayout.setOnRefreshListener { 33 swipeRefreshlayout.setOnRefreshListener {
38 - textLessonsAdapter?.loadMoreModule?.isEnableLoadMore = false  
39 page = 1 34 page = 1
40 mViewModel.textLessons("", page) 35 mViewModel.textLessons("", page)
41 } 36 }
  37 + swipeRefreshlayout.setOnLoadMoreListener {
  38 + page++
  39 + mViewModel.textLessons("", page)
  40 + }
42 } 41 }
43 42
44 } 43 }
@@ -63,24 +62,22 @@ class TextCourseActivity : @@ -63,24 +62,22 @@ class TextCourseActivity :
63 } 62 }
64 63
65 fun initLoadMore() { 64 fun initLoadMore() {
66 - textLessonsAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {  
67 - override fun onLoadMore() {  
68 - binding.swipeRefreshlayout.isRefreshing = false  
69 - textLessonsAdapter?.loadMoreModule?.isEnableLoadMore = true  
70 - mViewModel.textLessons("", page)  
71 - }  
72 -  
73 - })  
74 - textLessonsAdapter?.loadMoreModule?.isAutoLoadMore = true  
75 - textLessonsAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false 65 +// textLessonsAdapter?.loadMoreModule?.setOnLoadMoreListener(object : OnLoadMoreListener {
  66 +// override fun onLoadMore() {
  67 +// binding.swipeRefreshlayout.finishLoadMore()
  68 +// binding.swipeRefreshlayout.finishRefresh()
  69 +//
  70 +// }
  71 +// })
  72 +// textLessonsAdapter?.loadMoreModule?.isAutoLoadMore = true
  73 +// textLessonsAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
76 } 74 }
77 75
78 76
79 override fun initDataObserver() { 77 override fun initDataObserver() {
80 mViewModel.mTextLessonBean.observe(this, { 78 mViewModel.mTextLessonBean.observe(this, {
81 - binding.swipeRefreshlayout.isRefreshing = false  
82 - textLessonsAdapter?.loadMoreModule?.isEnableLoadMore = true  
83 - 79 + binding.swipeRefreshlayout.finishLoadMore()
  80 + binding.swipeRefreshlayout.finishRefresh()
84 if (page == 1) { 81 if (page == 1) {
85 textLessonsAdapter?.setList(it.data.list.data) 82 textLessonsAdapter?.setList(it.data.list.data)
86 } else { 83 } else {
@@ -88,13 +85,8 @@ class TextCourseActivity : @@ -88,13 +85,8 @@ class TextCourseActivity :
88 } 85 }
89 86
90 if (it.data.list.data != null) { 87 if (it.data.list.data != null) {
91 - if (it.data.list.data.size < 10) {  
92 - textLessonsAdapter?.loadMoreModule?.loadMoreEnd()  
93 - } else {  
94 - textLessonsAdapter?.loadMoreModule?.loadMoreComplete()  
95 - } 88 + binding.swipeRefreshlayout.setEnableLoadMore(!(it.data.list.data.size < 10))
96 } 89 }
97 - ++page  
98 }) 90 })
99 } 91 }
100 } 92 }
@@ -36,6 +36,7 @@ class OnLiveCourseFragment @@ -36,6 +36,7 @@ class OnLiveCourseFragment
36 if (it.data.list.data.size < 10) { 36 if (it.data.list.data.size < 10) {
37 binding.smartRefresh.setNoMoreData(true) 37 binding.smartRefresh.setNoMoreData(true)
38 } 38 }
  39 + binding.smartRefresh.setEnableLoadMore(!(it.data.list.data.size < 10))
39 if (page == 1) { 40 if (page == 1) {
40 if (it.data.list.data.isEmpty()) { 41 if (it.data.list.data.isEmpty()) {
41 binding.smartRefresh.visibility = View.GONE 42 binding.smartRefresh.visibility = View.GONE
1 package com.br_technology.securitytrain_master.ui.view.mine.activity 1 package com.br_technology.securitytrain_master.ui.view.mine.activity
2 2
3 import android.graphics.Color 3 import android.graphics.Color
4 -import android.view.View  
5 import androidx.recyclerview.widget.RecyclerView 4 import androidx.recyclerview.widget.RecyclerView
6 import com.bigkoo.pickerview.builder.TimePickerBuilder 5 import com.bigkoo.pickerview.builder.TimePickerBuilder
7 import com.br_technology.securitytrain_master.R 6 import com.br_technology.securitytrain_master.R
@@ -22,7 +21,6 @@ import com.luck.picture.lib.config.PictureMimeType @@ -22,7 +21,6 @@ import com.luck.picture.lib.config.PictureMimeType
22 import com.luck.picture.lib.entity.LocalMedia 21 import com.luck.picture.lib.entity.LocalMedia
23 import com.luck.picture.lib.listener.OnResultCallbackListener 22 import com.luck.picture.lib.listener.OnResultCallbackListener
24 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity 23 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleActivity
25 -import java.text.DateFormat  
26 import java.text.SimpleDateFormat 24 import java.text.SimpleDateFormat
27 import java.util.* 25 import java.util.*
28 26
@@ -60,6 +58,7 @@ class CredentialsUpLoadActivity : @@ -60,6 +58,7 @@ class CredentialsUpLoadActivity :
60 title.setOnDismissListener { 58 title.setOnDismissListener {
61 finish() 59 finish()
62 } 60 }
  61 + toast("新增证件成功,请等待审核")
63 title.show() 62 title.show()
64 } 63 }
65 } 64 }
@@ -71,7 +71,8 @@ class ClassDutyCourseFragment(val type: Int) : @@ -71,7 +71,8 @@ class ClassDutyCourseFragment(val type: Int) :
71 @SuppressLint("SetTextI18n") 71 @SuppressLint("SetTextI18n")
72 override fun initDataObserver() { 72 override fun initDataObserver() {
73 mViewModel.listCourse.observe(this, { 73 mViewModel.listCourse.observe(this, {
74 - binding.smartRefresh.isRefreshing = false 74 + binding.smartRefresh.finishLoadMore()
  75 + binding.smartRefresh.finishRefresh()
75 lessonBean = it.data 76 lessonBean = it.data
76 if (lessonBean!!.lesson_class_count > 0) { 77 if (lessonBean!!.lesson_class_count > 0) {
77 binding.prUploadValue.progress = 100 * 78 binding.prUploadValue.progress = 100 *
@@ -89,14 +90,11 @@ class ClassDutyCourseFragment(val type: Int) : @@ -89,14 +90,11 @@ class ClassDutyCourseFragment(val type: Int) :
89 } else { 90 } else {
90 courseAdapter?.addData(list) 91 courseAdapter?.addData(list)
91 } 92 }
92 - if (list.size < 10) {  
93 - courseAdapter?.loadMoreModule?.loadMoreEnd()  
94 - } else {  
95 - courseAdapter?.loadMoreModule?.loadMoreComplete()  
96 - } 93 + binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
97 }) 94 })
98 mViewModel.listPractise.observe(this, { 95 mViewModel.listPractise.observe(this, {
99 - binding.smartRefresh.isRefreshing = false 96 + binding.smartRefresh.finishLoadMore()
  97 + binding.smartRefresh.finishRefresh()
100 val list = it.data.list 98 val list = it.data.list
101 if (page == 1) { 99 if (page == 1) {
102 trainTestAdapter = TrainTestAdapter() 100 trainTestAdapter = TrainTestAdapter()
@@ -107,14 +105,11 @@ class ClassDutyCourseFragment(val type: Int) : @@ -107,14 +105,11 @@ class ClassDutyCourseFragment(val type: Int) :
107 } else { 105 } else {
108 trainTestAdapter?.addData(transPracticeData(list)) 106 trainTestAdapter?.addData(transPracticeData(list))
109 } 107 }
110 - if (list.size < 10) {  
111 - trainTestAdapter?.loadMoreModule?.loadMoreEnd()  
112 - } else {  
113 - trainTestAdapter?.loadMoreModule?.loadMoreComplete()  
114 - } 108 + binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
115 }) 109 })
116 mViewModel.listExam.observe(this, { 110 mViewModel.listExam.observe(this, {
117 - binding.smartRefresh.isRefreshing = false 111 + binding.smartRefresh.finishLoadMore()
  112 + binding.smartRefresh.finishRefresh()
118 val list = it.data.list 113 val list = it.data.list
119 if (page == 1) { 114 if (page == 1) {
120 trainTestAdapter = TrainTestAdapter() 115 trainTestAdapter = TrainTestAdapter()
@@ -125,11 +120,7 @@ class ClassDutyCourseFragment(val type: Int) : @@ -125,11 +120,7 @@ class ClassDutyCourseFragment(val type: Int) :
125 } else { 120 } else {
126 trainTestAdapter?.addData(transExamData(list)) 121 trainTestAdapter?.addData(transExamData(list))
127 } 122 }
128 - if (list.size < 10) {  
129 - trainTestAdapter?.loadMoreModule?.loadMoreEnd()  
130 - } else {  
131 - trainTestAdapter?.loadMoreModule?.loadMoreComplete()  
132 - } 123 + binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
133 }) 124 })
134 } 125 }
135 126
@@ -199,25 +190,18 @@ class ClassDutyCourseFragment(val type: Int) : @@ -199,25 +190,18 @@ class ClassDutyCourseFragment(val type: Int) :
199 binding.smartRefresh.setOnRefreshListener { 190 binding.smartRefresh.setOnRefreshListener {
200 refreshData() 191 refreshData()
201 } 192 }
  193 + binding.smartRefresh.setOnLoadMoreListener {
  194 + loadMore()
  195 + }
202 when (type) { 196 when (type) {
203 ConstantType.TYPE_CLASS_COURSE -> { 197 ConstantType.TYPE_CLASS_COURSE -> {
204 courseAdapter = CourseAdapter() 198 courseAdapter = CourseAdapter()
205 binding.recyclerview.adapter = courseAdapter 199 binding.recyclerview.adapter = courseAdapter
206 - courseAdapter?.loadMoreModule?.isAutoLoadMore = true  
207 - courseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false  
208 - courseAdapter?.loadMoreModule?.setOnLoadMoreListener {  
209 - loadMore()  
210 - }  
211 binding.tvNoData.text = "暂无课程" 200 binding.tvNoData.text = "暂无课程"
212 } 201 }
213 else -> { 202 else -> {
214 trainTestAdapter = TrainTestAdapter() 203 trainTestAdapter = TrainTestAdapter()
215 binding.recyclerview.adapter = trainTestAdapter 204 binding.recyclerview.adapter = trainTestAdapter
216 - trainTestAdapter?.loadMoreModule?.isAutoLoadMore = true  
217 - trainTestAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false  
218 - courseAdapter?.loadMoreModule?.setOnLoadMoreListener {  
219 - loadMore()  
220 - }  
221 if (ConstantType.TYPE_CLASS_PRACTICE == type) { 205 if (ConstantType.TYPE_CLASS_PRACTICE == type) {
222 binding.tvNoData.text = "暂无练习" 206 binding.tvNoData.text = "暂无练习"
223 } else { 207 } else {
@@ -27,8 +27,9 @@ class CourseFragment : @@ -27,8 +27,9 @@ class CourseFragment :
27 BaseLifeCycleFragment<DatabaseFViewModel, FragmentCourseBinding>(FragmentCourseBinding::inflate) { 27 BaseLifeCycleFragment<DatabaseFViewModel, FragmentCourseBinding>(FragmentCourseBinding::inflate) {
28 var page = 1 28 var page = 1
29 var docAdapter = TxtAdapter() 29 var docAdapter = TxtAdapter()
30 - override fun initData() {  
31 - super.initData() 30 +
  31 + override fun onResume() {
  32 + super.onResume()
32 refresh() 33 refresh()
33 } 34 }
34 35
@@ -27,8 +27,9 @@ class DatabaseFragment : @@ -27,8 +27,9 @@ class DatabaseFragment :
27 27
28 var page = 1 28 var page = 1
29 var docAdapter = DocAdapter() 29 var docAdapter = DocAdapter()
30 - override fun initData() {  
31 - super.initData() 30 +
  31 + override fun onResume() {
  32 + super.onResume()
32 refresh() 33 refresh()
33 } 34 }
34 35
@@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.mine.fragment @@ -2,11 +2,10 @@ package com.br_technology.securitytrain_master.ui.view.mine.fragment
2 2
3 import android.content.Intent 3 import android.content.Intent
4 import android.os.Bundle 4 import android.os.Bundle
5 -import com.br_technology.securitytrain_master.R 5 +import android.view.View
6 import com.br_technology.securitytrain_master.databinding.FragmentSpecialExercisesBinding 6 import com.br_technology.securitytrain_master.databinding.FragmentSpecialExercisesBinding
7 import com.br_technology.securitytrain_master.ui.bean.AnswerRecord 7 import com.br_technology.securitytrain_master.ui.bean.AnswerRecord
8 import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerRecordDetailsActivity 8 import com.br_technology.securitytrain_master.ui.view.bank.activity.AnswerRecordDetailsActivity
9 -import com.br_technology.securitytrain_master.ui.view.home.pojo.VideoCourse  
10 import com.br_technology.securitytrain_master.ui.view.mine.adapter.SpecialExercisesAdapter 9 import com.br_technology.securitytrain_master.ui.view.mine.adapter.SpecialExercisesAdapter
11 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SpecialExercisesFragmentViewModel 10 import com.br_technology.securitytrain_master.ui.view.mine.viewmodel.SpecialExercisesFragmentViewModel
12 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment 11 import com.wjx.android.wanandroidmvvm.base.view.BaseLifeCycleFragment
@@ -37,10 +36,19 @@ class SpecialExercisesFragment @@ -37,10 +36,19 @@ class SpecialExercisesFragment
37 binding.smartRefresh.setNoMoreData(true) 36 binding.smartRefresh.setNoMoreData(true)
38 } 37 }
39 if (page == 1) { 38 if (page == 1) {
  39 + val list = it.data.list.data
40 exercisesAdapter.setNewInstance(it.data.list.data as MutableList<AnswerRecord>) 40 exercisesAdapter.setNewInstance(it.data.list.data as MutableList<AnswerRecord>)
  41 + if (list.isEmpty()) {
  42 + binding.tvNoData.visibility = View.VISIBLE
  43 + binding.smartRefresh.visibility = View.GONE
  44 + } else {
  45 + binding.smartRefresh.visibility = View.VISIBLE
  46 + binding.tvNoData.visibility = View.GONE
  47 + }
41 } else { 48 } else {
42 exercisesAdapter.addData(it.data.list.data) 49 exercisesAdapter.addData(it.data.list.data)
43 } 50 }
  51 + binding.smartRefresh.setEnableLoadMore(!(it.data.list.data.size <= 20))
44 } 52 }
45 } 53 }
46 54
@@ -48,7 +56,6 @@ class SpecialExercisesFragment @@ -48,7 +56,6 @@ class SpecialExercisesFragment
48 super.initData() 56 super.initData()
49 type = arguments?.getInt("type") ?: 1 57 type = arguments?.getInt("type") ?: 1
50 58
51 -  
52 binding.apply { 59 binding.apply {
53 smartRefresh.setOnRefreshListener { 60 smartRefresh.setOnRefreshListener {
54 page = 1 61 page = 1
@@ -67,8 +74,6 @@ class SpecialExercisesFragment @@ -67,8 +74,6 @@ class SpecialExercisesFragment
67 intent.putExtra("id", exercisesAdapter.data[position].id) 74 intent.putExtra("id", exercisesAdapter.data[position].id)
68 startActivity(intent) 75 startActivity(intent)
69 } 76 }
70 -  
71 -  
72 } 77 }
73 } 78 }
74 79
@@ -7,6 +7,7 @@ import android.text.Spannable @@ -7,6 +7,7 @@ import android.text.Spannable
7 import android.text.SpannableString 7 import android.text.SpannableString
8 import android.text.style.AbsoluteSizeSpan 8 import android.text.style.AbsoluteSizeSpan
9 import android.text.style.ForegroundColorSpan 9 import android.text.style.ForegroundColorSpan
  10 +import android.view.Gravity
10 import android.view.LayoutInflater 11 import android.view.LayoutInflater
11 import android.view.View 12 import android.view.View
12 import androidx.core.content.ContextCompat 13 import androidx.core.content.ContextCompat
@@ -115,6 +116,7 @@ class DialogTitle(context: Context) : Dialog(context, R.style.UserDefaultDialog) @@ -115,6 +116,7 @@ class DialogTitle(context: Context) : Dialog(context, R.style.UserDefaultDialog)
115 116
116 fun setInfo(title: String): DialogTitle { 117 fun setInfo(title: String): DialogTitle {
117 binding.info.text = title 118 binding.info.text = title
  119 + binding.info.gravity = Gravity.START
118 binding.info.visibility = View.VISIBLE 120 binding.info.visibility = View.VISIBLE
119 return this 121 return this
120 } 122 }
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 android:layout_gravity="center_vertical" 70 android:layout_gravity="center_vertical"
71 android:layout_marginStart="16dp" 71 android:layout_marginStart="16dp"
72 android:layout_weight="1" 72 android:layout_weight="1"
73 - android:text="有效期时间" 73 + android:text="初始取证时间"
74 android:textColor="@color/color_32" 74 android:textColor="@color/color_32"
75 android:textSize="14sp" /> 75 android:textSize="14sp" />
76 76
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
37 37
38 <ImageView 38 <ImageView
39 android:id="@+id/share" 39 android:id="@+id/share"
  40 + android:visibility="gone"
40 android:layout_width="48dp" 41 android:layout_width="48dp"
41 android:layout_height="match_parent" 42 android:layout_height="match_parent"
42 android:foreground="?android:attr/selectableItemBackground" 43 android:foreground="?android:attr/selectableItemBackground"
@@ -13,22 +13,29 @@ @@ -13,22 +13,29 @@
13 android:layout_height="wrap_content" 13 android:layout_height="wrap_content"
14 app:toolTitle="文本课程" /> 14 app:toolTitle="文本课程" />
15 15
16 - <androidx.swiperefreshlayout.widget.SwipeRefreshLayout  
17 - android:layout_marginStart="16dp"  
18 - android:layout_marginTop="24dp"  
19 - android:layout_marginEnd="16dp" 16 + <com.scwang.smart.refresh.layout.SmartRefreshLayout
20 android:id="@+id/swipeRefreshlayout" 17 android:id="@+id/swipeRefreshlayout"
21 android:layout_width="match_parent" 18 android:layout_width="match_parent"
22 - android:layout_height="match_parent"> 19 + android:layout_height="match_parent"
  20 + android:layout_marginStart="16dp"
  21 + android:layout_marginTop="24dp"
  22 + android:layout_marginEnd="16dp">
23 23
  24 + <com.scwang.smart.refresh.header.ClassicsHeader
  25 + android:layout_width="match_parent"
  26 + android:layout_height="wrap_content" />
24 27
25 - <androidx.recyclerview.widget.RecyclerView  
26 - android:id="@+id/course_recycler"  
27 - android:layout_width="match_parent"  
28 - android:layout_height="match_parent"  
29 - android:overScrollMode="never"  
30 - android:scrollbars="none"  
31 - app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />  
32 - </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> 28 + <androidx.recyclerview.widget.RecyclerView
  29 + android:id="@+id/course_recycler"
  30 + android:layout_width="match_parent"
  31 + android:layout_height="match_parent"
  32 + android:overScrollMode="never"
  33 + android:scrollbars="none"
  34 + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
  35 +
  36 + <com.scwang.smart.refresh.footer.ClassicsFooter
  37 + android:layout_width="match_parent"
  38 + android:layout_height="wrap_content" />
  39 + </com.scwang.smart.refresh.layout.SmartRefreshLayout>
33 40
34 </LinearLayout> 41 </LinearLayout>
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
41 android:layout_height="match_parent" 41 android:layout_height="match_parent"
42 android:foreground="?android:attr/selectableItemBackground" 42 android:foreground="?android:attr/selectableItemBackground"
43 android:padding="12dp" 43 android:padding="12dp"
  44 + android:visibility="gone"
44 android:src="@mipmap/share" /> 45 android:src="@mipmap/share" />
45 </LinearLayout> 46 </LinearLayout>
46 47
@@ -22,12 +22,16 @@ @@ -22,12 +22,16 @@
22 android:background="@color/white" 22 android:background="@color/white"
23 android:orientation="vertical"> 23 android:orientation="vertical">
24 24
25 - <androidx.swiperefreshlayout.widget.SwipeRefreshLayout 25 + <com.scwang.smart.refresh.layout.SmartRefreshLayout
26 android:id="@+id/smart_refresh" 26 android:id="@+id/smart_refresh"
27 android:layout_width="match_parent" 27 android:layout_width="match_parent"
28 android:layout_height="0dp" 28 android:layout_height="0dp"
29 android:layout_weight="1"> 29 android:layout_weight="1">
30 30
  31 + <com.scwang.smart.refresh.header.ClassicsHeader
  32 + android:layout_width="match_parent"
  33 + android:layout_height="wrap_content"/>
  34 +
31 <androidx.recyclerview.widget.RecyclerView 35 <androidx.recyclerview.widget.RecyclerView
32 android:id="@+id/recyclerview" 36 android:id="@+id/recyclerview"
33 android:layout_width="match_parent" 37 android:layout_width="match_parent"
@@ -38,7 +42,11 @@ @@ -38,7 +42,11 @@
38 android:overScrollMode="never" 42 android:overScrollMode="never"
39 android:scrollbars="none" 43 android:scrollbars="none"
40 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> 44 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
41 - </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> 45 +
  46 + <com.scwang.smart.refresh.footer.ClassicsFooter
  47 + android:layout_width="match_parent"
  48 + android:layout_height="wrap_content"/>
  49 + </com.scwang.smart.refresh.layout.SmartRefreshLayout>
42 50
43 <LinearLayout 51 <LinearLayout
44 android:id="@+id/ll" 52 android:id="@+id/ll"
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 +<FrameLayout 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:orientation="vertical" 4 android:orientation="vertical"
5 android:background="@color/white" 5 android:background="@color/white"
6 android:layout_width="match_parent" 6 android:layout_width="match_parent"
7 android:layout_height="match_parent"> 7 android:layout_height="match_parent">
8 8
9 - <com.scwang.smart.refresh.layout.SmartRefreshLayout 9 + <TextView
  10 + android:id="@+id/tv_no_data"
  11 + android:layout_width="match_parent"
  12 + android:layout_height="wrap_content"
  13 + android:layout_marginTop="24dp"
  14 + android:text="暂无答题记录"
  15 + android:gravity="center"
  16 + android:visibility="gone" />
  17 +
  18 + <com.scwang.smart.refresh.layout.SmartRefreshLayout
10 android:id="@+id/smart_refresh" 19 android:id="@+id/smart_refresh"
11 android:layout_width="match_parent" 20 android:layout_width="match_parent"
12 android:layout_height="match_parent"> 21 android:layout_height="match_parent">
  22 +
  23 + <com.scwang.smart.refresh.header.ClassicsHeader
  24 + android:layout_width="match_parent"
  25 + android:layout_height="wrap_content"/>
  26 +
13 <androidx.recyclerview.widget.RecyclerView 27 <androidx.recyclerview.widget.RecyclerView
14 android:id="@+id/recyclerview" 28 android:id="@+id/recyclerview"
15 android:layout_width="match_parent" 29 android:layout_width="match_parent"
@@ -21,6 +35,9 @@ @@ -21,6 +35,9 @@
21 android:scrollbars="none" 35 android:scrollbars="none"
22 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> 36 app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
23 37
  38 + <com.scwang.smart.refresh.footer.ClassicsFooter
  39 + android:layout_width="match_parent"
  40 + android:layout_height="wrap_content"/>
24 </com.scwang.smart.refresh.layout.SmartRefreshLayout> 41 </com.scwang.smart.refresh.layout.SmartRefreshLayout>
25 42
26 -</LinearLayout>  
  43 +</FrameLayout>
@@ -12,4 +12,11 @@ @@ -12,4 +12,11 @@
12 android:contentDescription="@string/logo" 12 android:contentDescription="@string/logo"
13 android:scaleType="fitXY" 13 android:scaleType="fitXY"
14 android:src="@mipmap/my_credentials_upload_bg" /> 14 android:src="@mipmap/my_credentials_upload_bg" />
  15 +
  16 + <TextView
  17 + android:layout_width="wrap_content"
  18 + android:layout_height="wrap_content"
  19 + android:layout_gravity="center"
  20 + android:textColor="@color/black"
  21 + android:text="上传证件"/>
15 </LinearLayout> 22 </LinearLayout>