@@ -40,9 +40,9 @@ class AdapterStatisticsCourseChapterInfo : BaseRVAdapter<Lesson>() { | |||
tv2.text = "学习进度" | |||
tv2Value.text = "${NumberUtils.formatHalfUp(it.beforeTestScore, "0.#")}%" | |||
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( | |||
"<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 = "知识点测试" | |||
if (it.afterTestScore != AppConstants.NOT_DOING) { | |||
it.afterTestScore.toInt().let { |
@@ -156,14 +156,14 @@ object DBCourseManager { | |||
mutableList.add(lesson) | |||
positionIndex += 1 | |||
// 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() | |||
} |
@@ -13,6 +13,8 @@ import com.github.mikephil.charting.data.BarDataSet | |||
import com.github.mikephil.charting.data.BarEntry | |||
import com.github.mikephil.charting.formatter.ValueFormatter | |||
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.extension.click | |||
import com.suliang.common.extension.setHtml | |||
@@ -44,9 +46,7 @@ class CourseStatisticsDetailActivity : BaseActivityVM<ActivityCourseStatisticsDe | |||
override fun initActivity(savedInstanceState : Bundle?) { | |||
binding.titleBar.onBackClick = { _ -> finish() } | |||
binding.course = vm.currentStatisCourse | |||
initChart() | |||
binding.rvChapterInfo.apply { | |||
@@ -57,18 +57,18 @@ class CourseStatisticsDetailActivity : BaseActivityVM<ActivityCourseStatisticsDe | |||
if (vm.statisticsCourseList.size <= 1){ | |||
binding.ivChangeCourse.visibility = View.INVISIBLE | |||
}else{ | |||
// TODO: 2022/7/1 弹窗实例失败 | |||
//课程切换弹窗 | |||
binding.ivChangeCourse.click { | |||
if (!this::pupCourseChangeView.isInitialized){ | |||
pupCourseChangeView = StatisticsICourseChangePopup(this).apply { | |||
data = vm.statisticsCourseList | |||
checkPostion = vm.checkedPosition | |||
onAdapterItemClick = { position,item -> | |||
vm.checkedPosition = position | |||
vm.currentStatisCourse = item | |||
binding.course = item | |||
loadData() | |||
} | |||
data = vm.statisticsCourseList | |||
} | |||
} | |||
XPopup.Builder(this).asCustom(pupCourseChangeView).show() | |||
@@ -123,9 +123,25 @@ class CourseStatisticsDetailActivity : BaseActivityVM<ActivityCourseStatisticsDe | |||
} | |||
//根据生成的数据,进行选择器的实现 | |||
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){ | |||
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 | |||
}else { | |||
View.GONE |
@@ -63,6 +63,7 @@ class SubjectStatisticsDetailActivity : BaseActivity<ActivitySubjectStatisticsBi | |||
override fun loadData() { | |||
val coursePackList = CourseManager.subjectWithCoursePackMap.get(projectId) | |||
if (coursePackList.isNullOrEmpty()){ | |||
adapter.needShowEmptyView = true | |||
adapter.setData(emptyList<StatisticsCourse>().toMutableList()) | |||
}else{ | |||
//组合统计课程实体病设置进度值 | |||
@@ -80,6 +81,7 @@ class SubjectStatisticsDetailActivity : BaseActivity<ActivitySubjectStatisticsBi | |||
} | |||
} | |||
} | |||
adapter.needShowEmptyView = statisticsCourseList.size == 0 | |||
//设置列表数据 | |||
adapter.setData(statisticsCourseList) | |||
} |
@@ -47,6 +47,7 @@ class StatisticsICourseChangePopup(context : Context) : BottomPopupView(context) | |||
checkPosition = checkPostion | |||
onItemClick = {_,p,item -> | |||
if (this@StatisticsICourseChangePopup::onAdapterItemClick.isInitialized){ | |||
dismiss() | |||
onAdapterItemClick.invoke(p,item) | |||
} | |||
} | |||
@@ -66,7 +67,6 @@ class StatisticsICourseChangePopup(context : Context) : BottomPopupView(context) | |||
} | |||
// TODO: 2022/7/1 适配器inflate 失败 | |||
internal class Adapter : BaseRVAdapter<StatisticsCourse>(){ | |||
var checkPosition = 0 | |||
@@ -82,7 +82,7 @@ internal class Adapter : BaseRVAdapter<StatisticsCourse>(){ | |||
} | |||
when(position){ | |||
checkPosition -> { | |||
layout.setBackgroundColor(Color.parseColor("0D5082E6")) | |||
layout.setBackgroundColor(Color.parseColor("#0D5082E6")) | |||
tvName.setTextColor(ContextCompat.getColor(context,R.color.theme_color)) | |||
tvValue.setTextColor(ContextCompat.getColor(context,R.color.theme_color)) | |||
} | |||
@@ -95,6 +95,7 @@ internal class Adapter : BaseRVAdapter<StatisticsCourse>(){ | |||
} | |||
holder.binding.root.click { | |||
if (checkPosition != position){ | |||
checkPosition = position | |||
notifyDataSetChanged() | |||
if (onItemClickIsInitialized()){ | |||
onItemClick.invoke(it,position,getItem(position)) |
@@ -621,7 +621,7 @@ | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/layout_chapter_info" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="12dp" | |||
android:background="@drawable/shape_rounder_12_white" | |||
android:padding="12dp" | |||
@@ -663,7 +663,7 @@ | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/rv_chapter_info" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_height="match_parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_info_flag" |
@@ -56,7 +56,8 @@ | |||
android:id="@+id/rv_course" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="1" /> | |||
android:layout_weight="1" | |||
android:paddingBottom="12dp"/> | |||
</androidx.appcompat.widget.LinearLayoutCompat> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -8,7 +8,7 @@ | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="@drawable/shape_rounder_toplr_24_white"> | |||
<TextView |
@@ -10,7 +10,8 @@ | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:layout_width="match_parent" | |||
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 | |||
android:id="@+id/v_1" |