...
|
...
|
@@ -71,7 +71,8 @@ class ClassDutyCourseFragment(val type: Int) : |
|
|
@SuppressLint("SetTextI18n")
|
|
|
override fun initDataObserver() {
|
|
|
mViewModel.listCourse.observe(this, {
|
|
|
binding.smartRefresh.isRefreshing = false
|
|
|
binding.smartRefresh.finishLoadMore()
|
|
|
binding.smartRefresh.finishRefresh()
|
|
|
lessonBean = it.data
|
|
|
if (lessonBean!!.lesson_class_count > 0) {
|
|
|
binding.prUploadValue.progress = 100 *
|
...
|
...
|
@@ -89,14 +90,11 @@ class ClassDutyCourseFragment(val type: Int) : |
|
|
} else {
|
|
|
courseAdapter?.addData(list)
|
|
|
}
|
|
|
if (list.size < 10) {
|
|
|
courseAdapter?.loadMoreModule?.loadMoreEnd()
|
|
|
} else {
|
|
|
courseAdapter?.loadMoreModule?.loadMoreComplete()
|
|
|
}
|
|
|
binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
|
|
|
})
|
|
|
mViewModel.listPractise.observe(this, {
|
|
|
binding.smartRefresh.isRefreshing = false
|
|
|
binding.smartRefresh.finishLoadMore()
|
|
|
binding.smartRefresh.finishRefresh()
|
|
|
val list = it.data.list
|
|
|
if (page == 1) {
|
|
|
trainTestAdapter = TrainTestAdapter()
|
...
|
...
|
@@ -107,14 +105,11 @@ class ClassDutyCourseFragment(val type: Int) : |
|
|
} else {
|
|
|
trainTestAdapter?.addData(transPracticeData(list))
|
|
|
}
|
|
|
if (list.size < 10) {
|
|
|
trainTestAdapter?.loadMoreModule?.loadMoreEnd()
|
|
|
} else {
|
|
|
trainTestAdapter?.loadMoreModule?.loadMoreComplete()
|
|
|
}
|
|
|
binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
|
|
|
})
|
|
|
mViewModel.listExam.observe(this, {
|
|
|
binding.smartRefresh.isRefreshing = false
|
|
|
binding.smartRefresh.finishLoadMore()
|
|
|
binding.smartRefresh.finishRefresh()
|
|
|
val list = it.data.list
|
|
|
if (page == 1) {
|
|
|
trainTestAdapter = TrainTestAdapter()
|
...
|
...
|
@@ -125,11 +120,7 @@ class ClassDutyCourseFragment(val type: Int) : |
|
|
} else {
|
|
|
trainTestAdapter?.addData(transExamData(list))
|
|
|
}
|
|
|
if (list.size < 10) {
|
|
|
trainTestAdapter?.loadMoreModule?.loadMoreEnd()
|
|
|
} else {
|
|
|
trainTestAdapter?.loadMoreModule?.loadMoreComplete()
|
|
|
}
|
|
|
binding.smartRefresh.setEnableLoadMore(!(list.size < 10))
|
|
|
})
|
|
|
}
|
|
|
|
...
|
...
|
@@ -199,25 +190,18 @@ class ClassDutyCourseFragment(val type: Int) : |
|
|
binding.smartRefresh.setOnRefreshListener {
|
|
|
refreshData()
|
|
|
}
|
|
|
binding.smartRefresh.setOnLoadMoreListener {
|
|
|
loadMore()
|
|
|
}
|
|
|
when (type) {
|
|
|
ConstantType.TYPE_CLASS_COURSE -> {
|
|
|
courseAdapter = CourseAdapter()
|
|
|
binding.recyclerview.adapter = courseAdapter
|
|
|
courseAdapter?.loadMoreModule?.isAutoLoadMore = true
|
|
|
courseAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
|
|
|
courseAdapter?.loadMoreModule?.setOnLoadMoreListener {
|
|
|
loadMore()
|
|
|
}
|
|
|
binding.tvNoData.text = "暂无课程"
|
|
|
}
|
|
|
else -> {
|
|
|
trainTestAdapter = TrainTestAdapter()
|
|
|
binding.recyclerview.adapter = trainTestAdapter
|
|
|
trainTestAdapter?.loadMoreModule?.isAutoLoadMore = true
|
|
|
trainTestAdapter?.loadMoreModule?.isEnableLoadMoreIfNotFullPage = false
|
|
|
courseAdapter?.loadMoreModule?.setOnLoadMoreListener {
|
|
|
loadMore()
|
|
|
}
|
|
|
if (ConstantType.TYPE_CLASS_PRACTICE == type) {
|
|
|
binding.tvNoData.text = "暂无练习"
|
|
|
} else {
|
...
|
...
|
|