Browse Source

统计完成

master
suliang 2 years ago
parent
commit
8d205c6ec5

+ 2
- 2
app/src/main/java/com/xkl/cdl/adapter/AdapterStatisticsCourseChapterInfo.kt View File

tv2.text = "学习进度" tv2.text = "学习进度"
tv2Value.text = "${NumberUtils.formatHalfUp(it.beforeTestScore, "0.#")}%" tv2Value.text = "${NumberUtils.formatHalfUp(it.beforeTestScore, "0.#")}%"
tv3.setHtml( tv3.setHtml(
"<font color=\"#323232\">条目-</font><font color=\"#40A540\">正确</font>|<font color=\"#F26255\">错误</font>")
"<font color=\"#323232\">条目-</font><font color=\"#40A540\">正确</font> | <font color=\"#F26255\">错误</font>")
tv3Value.setHtml( tv3Value.setHtml(
"<font color=\"#323232\">${it.totalNumber}-</font><font color=\"#40A540\">${it.correctNumber}</font>|<font color=\"#F26255\">${it.errorNumber}</font>")
"<font color=\"#323232\">${it.totalNumber}-</font><font color=\"#40A540\">${it.correctNumber}</font> | <font color=\"#F26255\">${it.errorNumber}</font>")
tv4.text = "知识点测试" tv4.text = "知识点测试"
if (it.afterTestScore != AppConstants.NOT_DOING) { if (it.afterTestScore != AppConstants.NOT_DOING) {
it.afterTestScore.toInt().let { it.afterTestScore.toInt().let {

+ 8
- 8
app/src/main/java/com/xkl/cdl/data/manager/db/DBCourseManager.kt View File

mutableList.add(lesson) mutableList.add(lesson)
positionIndex += 1 positionIndex += 1
// TODO: 2022/5/9 对课时数量进行限制,课时太多,开发人员不好进行测试 // TODO: 2022/5/9 对课时数量进行限制,课时太多,开发人员不好进行测试
val needBreak = when (base.coursePackType) {
AppConstants.COURSEPACK_TYPE_CHINESE_COMPOSITION -> positionIndex == 10 //保留十个课时
AppConstants.COURSEPACK_TYPE_ENGLISH_SPOKEN -> positionIndex == 6 //保留六个课时
else -> positionIndex == 3 //保留三个课时
}
if (needBreak) {
break
}
// val needBreak = when (base.coursePackType) {
// AppConstants.COURSEPACK_TYPE_CHINESE_COMPOSITION -> positionIndex == 10 //保留十个课时
// AppConstants.COURSEPACK_TYPE_ENGLISH_SPOKEN -> positionIndex == 6 //保留六个课时
// else -> positionIndex == 3 //保留三个课时
// }
// if (needBreak) {
// break
// }
} }
it.close() it.close()
} }

+ 21
- 5
app/src/main/java/com/xkl/cdl/module/m_statics/CourseStatisticsDetailActivity.kt View File

import com.github.mikephil.charting.data.BarEntry import com.github.mikephil.charting.data.BarEntry
import com.github.mikephil.charting.formatter.ValueFormatter import com.github.mikephil.charting.formatter.ValueFormatter
import com.lxj.xpopup.XPopup import com.lxj.xpopup.XPopup
import com.lxj.xpopup.enums.PopupPosition
import com.lxj.xpopup.interfaces.OnSelectListener
import com.suliang.common.base.activity.BaseActivityVM import com.suliang.common.base.activity.BaseActivityVM
import com.suliang.common.extension.click import com.suliang.common.extension.click
import com.suliang.common.extension.setHtml import com.suliang.common.extension.setHtml
override fun initActivity(savedInstanceState : Bundle?) { override fun initActivity(savedInstanceState : Bundle?) {
binding.titleBar.onBackClick = { _ -> finish() } binding.titleBar.onBackClick = { _ -> finish() }
binding.course = vm.currentStatisCourse binding.course = vm.currentStatisCourse
initChart() initChart()
binding.rvChapterInfo.apply { binding.rvChapterInfo.apply {
if (vm.statisticsCourseList.size <= 1){ if (vm.statisticsCourseList.size <= 1){
binding.ivChangeCourse.visibility = View.INVISIBLE binding.ivChangeCourse.visibility = View.INVISIBLE
}else{ }else{
// TODO: 2022/7/1 弹窗实例失败
//课程切换弹窗 //课程切换弹窗
binding.ivChangeCourse.click { binding.ivChangeCourse.click {
if (!this::pupCourseChangeView.isInitialized){ if (!this::pupCourseChangeView.isInitialized){
pupCourseChangeView = StatisticsICourseChangePopup(this).apply { pupCourseChangeView = StatisticsICourseChangePopup(this).apply {
data = vm.statisticsCourseList
checkPostion = vm.checkedPosition checkPostion = vm.checkedPosition
onAdapterItemClick = { position,item -> onAdapterItemClick = { position,item ->
vm.checkedPosition = position vm.checkedPosition = position
vm.currentStatisCourse = item vm.currentStatisCourse = item
binding.course = item
loadData() loadData()
} }
data = vm.statisticsCourseList
} }
} }
XPopup.Builder(this).asCustom(pupCourseChangeView).show() XPopup.Builder(this).asCustom(pupCourseChangeView).show()
} }
//根据生成的数据,进行选择器的实现 //根据生成的数据,进行选择器的实现
when(vm.chapterList.size){ when(vm.chapterList.size){
0,1 -> binding.tvChapterChoose.visibility = View.GONE
0,1 -> {
binding.tvChapterChoose.visibility = View.GONE
binding.tvChapterChoose.click { null }
}
else -> binding.tvChapterChoose.visibility = if(vm.chapterList[0].size > 0){ else -> binding.tvChapterChoose.visibility = if(vm.chapterList[0].size > 0){
binding.tvChapterChoose.text = vm.chapterList[0][0].chapterName binding.tvChapterChoose.text = vm.chapterList[0][0].chapterName
binding.tvChapterChoose.click {
XPopup.Builder(this)
.atView(binding.tvChapterChoose)
.hasShadowBg(false)
.hasStatusBar(true)
.isLightStatusBar(true)
.asAttachList(vm.chapterList.map {
it[0].chapterName
}.toTypedArray(), intArrayOf(), { position, text ->
binding.tvChapterChoose.text = text
vm.rvChapterChangeLiveData.value = position
},0, R.layout.item_xpopup_statistics_choose_subject).show()
}
View.VISIBLE View.VISIBLE
}else { }else {
View.GONE View.GONE

+ 2
- 0
app/src/main/java/com/xkl/cdl/module/m_statics/SubjectStatisticsDetailActivity.kt View File

override fun loadData() { override fun loadData() {
val coursePackList = CourseManager.subjectWithCoursePackMap.get(projectId) val coursePackList = CourseManager.subjectWithCoursePackMap.get(projectId)
if (coursePackList.isNullOrEmpty()){ if (coursePackList.isNullOrEmpty()){
adapter.needShowEmptyView = true
adapter.setData(emptyList<StatisticsCourse>().toMutableList()) adapter.setData(emptyList<StatisticsCourse>().toMutableList())
}else{ }else{
//组合统计课程实体病设置进度值 //组合统计课程实体病设置进度值
} }
} }
} }
adapter.needShowEmptyView = statisticsCourseList.size == 0
//设置列表数据 //设置列表数据
adapter.setData(statisticsCourseList) adapter.setData(statisticsCourseList)
} }

+ 3
- 2
app/src/main/java/com/xkl/cdl/widget/StatisticsICourseChangePopup.kt View File

checkPosition = checkPostion checkPosition = checkPostion
onItemClick = {_,p,item -> onItemClick = {_,p,item ->
if (this@StatisticsICourseChangePopup::onAdapterItemClick.isInitialized){ if (this@StatisticsICourseChangePopup::onAdapterItemClick.isInitialized){
dismiss()
onAdapterItemClick.invoke(p,item) onAdapterItemClick.invoke(p,item)
} }
} }
} }


// TODO: 2022/7/1 适配器inflate 失败
internal class Adapter : BaseRVAdapter<StatisticsCourse>(){ internal class Adapter : BaseRVAdapter<StatisticsCourse>(){
var checkPosition = 0 var checkPosition = 0
} }
when(position){ when(position){
checkPosition -> { checkPosition -> {
layout.setBackgroundColor(Color.parseColor("0D5082E6"))
layout.setBackgroundColor(Color.parseColor("#0D5082E6"))
tvName.setTextColor(ContextCompat.getColor(context,R.color.theme_color)) tvName.setTextColor(ContextCompat.getColor(context,R.color.theme_color))
tvValue.setTextColor(ContextCompat.getColor(context,R.color.theme_color)) tvValue.setTextColor(ContextCompat.getColor(context,R.color.theme_color))
} }
} }
holder.binding.root.click { holder.binding.root.click {
if (checkPosition != position){ if (checkPosition != position){
checkPosition = position
notifyDataSetChanged() notifyDataSetChanged()
if (onItemClickIsInitialized()){ if (onItemClickIsInitialized()){
onItemClick.invoke(it,position,getItem(position)) onItemClick.invoke(it,position,getItem(position))

+ 2
- 2
app/src/main/res/layout/activity_course_statistics_detail.xml View File

<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_chapter_info" android:id="@+id/layout_chapter_info"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:background="@drawable/shape_rounder_12_white" android:background="@drawable/shape_rounder_12_white"
android:padding="12dp" android:padding="12dp"
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_chapter_info" android:id="@+id/rv_chapter_info"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_info_flag" app:layout_constraintTop_toBottomOf="@+id/tv_chapter_info_flag"

+ 2
- 1
app/src/main/res/layout/activity_subject_statistics.xml View File

android:id="@+id/rv_course" android:id="@+id/rv_course"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" />
android:layout_weight="1"
android:paddingBottom="12dp"/>
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>


</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

+ 1
- 1
app/src/main/res/layout/dialog_bottom_auto_play_select.xml View File



<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_rounder_toplr_24_white"> android:background="@drawable/shape_rounder_toplr_24_white">


<TextView <TextView

+ 2
- 1
app/src/main/res/layout/item_statistics_course_chapter_info.xml View File

<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_rounder_8_stroke_gray1">
android:background="@drawable/shape_rounder_8_stroke_gray1"
android:layout_marginTop="6dp">


<View <View
android:id="@+id/v_1" android:id="@+id/v_1"

Loading…
Cancel
Save