<entry key="..\:/Work/XKL/XklLocal/app/src/main/res/layout/activity_splash.xml" value="0.1" /> | <entry key="..\:/Work/XKL/XklLocal/app/src/main/res/layout/activity_splash.xml" value="0.1" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/drawable/shape_rounder_bottomlr_16_solider_white.xml" value="0.203125" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/drawable/shape_rounder_bottomlr_16_solider_white.xml" value="0.203125" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/drawable/shape_rounder_bottomlr_8_solider_white_1.xml" value="0.203125" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/drawable/shape_rounder_bottomlr_8_solider_white_1.xml" value="0.203125" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_course_main.xml" value="0.3338541666666667" /> | |||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_dictionary.xml" value="0.1933876811594203" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_dictionary.xml" value="0.1933876811594203" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_dictionary_floating_search.xml" value="0.75" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_dictionary_floating_search.xml" value="0.75" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_learn_exam.xml" value="0.21666666666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_learn_exam.xml" value="0.21666666666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_test_detail.xml" value="0.21666666666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/activity_test_detail.xml" value="0.21666666666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/dialog_common.xml" value="0.33" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/dialog_common.xml" value="0.33" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/dictionary_floating_layout.xml" value="0.5" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/dictionary_floating_layout.xml" value="0.5" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_course_main.xml" value="0.3338541666666667" /> | |||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_course_pack.xml" value="0.3338541666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_course_pack.xml" value="0.3338541666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_learn_center.xml" value="0.3338541666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_learn_center.xml" value="0.3338541666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_statistics_time_top.xml" value="0.23385416666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/fragment_statistics_time_top.xml" value="0.23385416666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/include_main_learn_center_course_progress.xml" value="0.3338541666666667" /> | |||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/item_statics_for_time.xml" value="0.24791666666666667" /> | <entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/item_statics_for_time.xml" value="0.24791666666666667" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/app/src/main/res/layout/main_item_coursepack.xml" value="0.22864583333333333" /> | |||||
<entry key="..\:/xuekaole/XKLLocal/lib/common/src/main/res/drawable/ic_search.xml" value="0.2212962962962963" /> | <entry key="..\:/xuekaole/XKLLocal/lib/common/src/main/res/drawable/ic_search.xml" value="0.2212962962962963" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/videoplayer/src/main/res/layout/pine_player_media_controller.xml" value="0.125" /> | <entry key="..\:/xuekaole/XKLLocal/videoplayer/src/main/res/layout/pine_player_media_controller.xml" value="0.125" /> | ||||
<entry key="..\:/xuekaole/XKLLocal/videoplayer/src/main/res/layout/pine_player_media_controller_full.xml" value="0.125" /> | <entry key="..\:/xuekaole/XKLLocal/videoplayer/src/main/res/layout/pine_player_media_controller_full.xml" value="0.125" /> |
) | ) | ||||
//课程包添加课程 | //课程包添加课程 | ||||
childrenCourses.add(course) | childrenCourses.add(course) | ||||
//初始作文设置进度 | |||||
if (subjectId == AppConstants.SUBJECT_CHINESE){ | |||||
//语文初始需要给设置一下其进度,用于显示 | |||||
run m@{ | |||||
CourseManager.mSortInfoList[AppConstants.SUBJECT_CHINESE]?.forEach { sortInfo -> | |||||
if (coursePackId == sortInfo.packId && course.courseId == sortInfo.courseId ){ | |||||
learnProgress = sortInfo.s //设置进度 | |||||
return@m | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
cursor.close() | cursor.close() | ||||
} | } |
import com.suliang.common.util.os.ScreenUtil | import com.suliang.common.util.os.ScreenUtil | ||||
import com.suliang.common.util.os.VersionUtil | import com.suliang.common.util.os.VersionUtil | ||||
import com.xkl.cdl.R | import com.xkl.cdl.R | ||||
import com.xkl.cdl.data.AppConstants | |||||
import com.xkl.cdl.databinding.DictionaryFloatingLayoutBinding | import com.xkl.cdl.databinding.DictionaryFloatingLayoutBinding | ||||
import com.xkl.cdl.module.XKLApplication | import com.xkl.cdl.module.XKLApplication | ||||
import kotlin.math.abs | import kotlin.math.abs | ||||
private var windowParams : WindowManager.LayoutParams? = null | private var windowParams : WindowManager.LayoutParams? = null | ||||
private var layoutBinding : DictionaryFloatingLayoutBinding? = null | private var layoutBinding : DictionaryFloatingLayoutBinding? = null | ||||
private var isShowing = false | private var isShowing = false | ||||
var courseId = 0 | |||||
set(value) { | |||||
field = value | |||||
private var courseId:Long = 0 | |||||
/** | |||||
* 显示词典 | |||||
*/ | |||||
public fun showFloatDictionary(subjectId:Int,courseId: Long = 0){ | |||||
if (subjectId == AppConstants.SUBJECT_ENGLISH){ | |||||
this.courseId = courseId | |||||
show() | |||||
} | } | ||||
} | |||||
// /** | |||||
// * 隐藏词典 | |||||
// */ | |||||
// public fun hideFloatDictionary(){ | |||||
// courseId = 0 | |||||
// hide() | |||||
// } | |||||
fun show() { | |||||
private fun show() { | |||||
if (!checkOverlayerPermission()) return | if (!checkOverlayerPermission()) return | ||||
windowParams?.let { | windowParams?.let { | ||||
layoutBinding?.root?.visibility = View.VISIBLE | layoutBinding?.root?.visibility = View.VISIBLE | ||||
isDrag = abs(x - mDownX) > scaledTouchSlop || abs(y - mDownY) > scaledTouchSlop | isDrag = abs(x - mDownX) > scaledTouchSlop || abs(y - mDownY) > scaledTouchSlop | ||||
if (!isDrag){ | if (!isDrag){ | ||||
ActivityStackManager.topActivity()?.let{ | ActivityStackManager.topActivity()?.let{ | ||||
DictionaryFloatingSearchActivity.instance(it) | |||||
DictionaryFloatingSearchActivity.instance(it,courseId) | |||||
} | } | ||||
} | } | ||||
} | } |
!isShowBackDialog -> showOrDismissBackDialogForTime(isShowBackDialog) | !isShowBackDialog -> showOrDismissBackDialogForTime(isShowBackDialog) | ||||
} | } | ||||
//不是在上传,且为英语类型,可显示词典浮窗 | //不是在上传,且为英语类型,可显示词典浮窗 | ||||
if (!isShowLoading && dbBaseControl.subjectId == AppConstants.SUBJECT_ENGLISH) { | |||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
if (!isShowLoading ) { | |||||
DictionaryFloatingWindowManager.getInstance().showFloatDictionary(dbBaseControl.subjectId,dbBaseControl.courseId) | |||||
} | } | ||||
} | } | ||||
it.onComplete() | it.onComplete() | ||||
}.compose(diskIo2Main()).subscribe({ | }.compose(diskIo2Main()).subscribe({ | ||||
showHideLoading(false) | showHideLoading(false) | ||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
DictionaryFloatingWindowManager.getInstance().showFloatDictionary(dbBaseControl.subjectId,dbBaseControl.courseId) | |||||
sendEventBus() //返回发送数据 | sendEventBus() //返回发送数据 | ||||
//数据保存完成后,通过数据为空进行通知,测试完成 | //数据保存完成后,通过数据为空进行通知,测试完成 | ||||
currentExamBean.value = null | currentExamBean.value = null | ||||
}, { | }, { | ||||
showHideLoading(false) | showHideLoading(false) | ||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
DictionaryFloatingWindowManager.getInstance().showFloatDictionary(dbBaseControl.subjectId,dbBaseControl.courseId) | |||||
it.printStackTrace() | it.printStackTrace() | ||||
}) | }) | ||||
} | } |
it.onComplete() | it.onComplete() | ||||
}.compose(diskIo2Main()).subscribe({ | }.compose(diskIo2Main()).subscribe({ | ||||
showHideLoading(false) | showHideLoading(false) | ||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
DictionaryFloatingWindowManager.getInstance() | |||||
.showFloatDictionary(dbControlBase.subjectId, dbControlBase.courseId) | |||||
sendEventBus() //返回发送数据 | sendEventBus() //返回发送数据 | ||||
//数据保存完成后,通过数据为空进行通知,完成 | //数据保存完成后,通过数据为空进行通知,完成 | ||||
saveDataLiveData.value = isAllOver | saveDataLiveData.value = isAllOver | ||||
}, { | }, { | ||||
showHideLoading(false) | showHideLoading(false) | ||||
it.printStackTrace() | it.printStackTrace() | ||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
DictionaryFloatingWindowManager.getInstance() | |||||
.showFloatDictionary(dbControlBase.subjectId, dbControlBase.courseId) | |||||
}) | }) | ||||
} | } | ||||
startTotalCounting() | startTotalCounting() | ||||
} | } | ||||
//不是在上传,且为英语类型,可显示词典浮窗 | //不是在上传,且为英语类型,可显示词典浮窗 | ||||
if (!isShowLoading && dbControlBase.subjectId == AppConstants.SUBJECT_ENGLISH) { | |||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
if (!isShowLoading) { | |||||
DictionaryFloatingWindowManager.getInstance().showFloatDictionary(dbControlBase.subjectId, dbControlBase.courseId) | |||||
} | } | ||||
} | } | ||||
vm.currentCourseProgress.observe(this) { | vm.currentCourseProgress.observe(this) { | ||||
binding.includeCourseProgress.apply { | binding.includeCourseProgress.apply { | ||||
//进度格式化 | //进度格式化 | ||||
progressbar.progress = it.toInt() | |||||
progressbar.progress = (it * 10).toInt() //进度条为千分制,需要乘十显示 | |||||
tvProgress.text = if (binding.includeCourseTypeTab.root.visibility == View.VISIBLE) { | tvProgress.text = if (binding.includeCourseTypeTab.root.visibility == View.VISIBLE) { | ||||
val format = when (binding.viewPager2.currentItem) { | val format = when (binding.viewPager2.currentItem) { | ||||
0 -> "认读进度: %s%%" | 0 -> "认读进度: %s%%" |
override fun onResume(owner : LifecycleOwner) { | override fun onResume(owner : LifecycleOwner) { | ||||
super.onResume(owner) | super.onResume(owner) | ||||
if (dbControlBase.subjectId == AppConstants.SUBJECT_ENGLISH){ | |||||
DictionaryFloatingWindowManager.getInstance().show() | |||||
} | |||||
DictionaryFloatingWindowManager.getInstance().showFloatDictionary(dbControlBase.subjectId,dbControlBase.courseId) | |||||
} | } | ||||
override fun onPause(owner : LifecycleOwner) { | override fun onPause(owner : LifecycleOwner) { | ||||
super.onPause(owner) | super.onPause(owner) |
result.add(initEfficiency(statistics)) //效率 | result.add(initEfficiency(statistics)) //效率 | ||||
result.add(initCourseCount(statistics)) //课程 | result.add(initCourseCount(statistics)) //课程 | ||||
result.add(initLearnProgress(statistics)) //已学进度 | result.add(initLearnProgress(statistics)) //已学进度 | ||||
/* //有效学习时长 | |||||
val timeStaticItem_1 = TimeStatisticItem().apply { | |||||
name = "有效学习时长" | |||||
backGround = R.drawable.shape_rounder_4_red_a5 | |||||
} | |||||
//计算显示使用的单位 | |||||
if (statistics.sd != 0L) { | |||||
val hour = statistics.sd / 3600000.0 | |||||
val minute = statistics.sd / 60000.0 | |||||
when { | |||||
//大于1小时 | |||||
hour > 1 -> { | |||||
timeStaticItem_1.time =initShow(hour) | |||||
timeStaticItem_1.unit = "小时" | |||||
} | |||||
//大于1分钟 | |||||
minute > 1 -> { | |||||
//取整和保留一位小数的值相同,则使用取整的值显示,否则使用保留小数的值显示 | |||||
timeStaticItem_1.time =initShow(minute) | |||||
timeStaticItem_1.unit = "分钟" | |||||
} | |||||
//小于1分钟 | |||||
else -> { | |||||
timeStaticItem_1.time = "" | |||||
timeStaticItem_1.unit = "不足1分钟" | |||||
} | |||||
} | |||||
}else{ | |||||
timeStaticItem_1.time = "" | |||||
timeStaticItem_1.unit = "不足1分钟" | |||||
} | |||||
initIncr(timeStaticItem_1,statistics.sdIncr.toDouble()) | |||||
//增量不为0 | |||||
if (statistics.sdIncr != 0L ){ | |||||
val hour_1 = statistics.sdIncr / 3600000.0 | |||||
val minute_1 = statistics.sdIncr / 60000.0 | |||||
val sencond = statistics.sdIncr / 1000 | |||||
when { | |||||
//大于1小时 | |||||
abs(hour_1) > 1 -> timeStaticItem_1.incr = if(statistics.sdIncr > 0) "${initShow(hour_1)}小时" else "-${initShow(abs(hour_1))}小时" | |||||
//大于1分钟 | |||||
abs(minute_1) > 1 -> timeStaticItem_1.incr = if(statistics.sdIncr > 0) "${initShow(minute_1)}分钟" else "-${initShow(abs(minute_1))}分钟" | |||||
//小于1分钟 秒数 | |||||
else -> timeStaticItem_1.incr = "${sencond}秒" | |||||
} | |||||
if (statistics.sdIncr > 0){ | |||||
timeStaticItem_1.incr = "+${timeStaticItem_1.incr}" | |||||
} | |||||
}else{ | |||||
timeStaticItem_1.incr = "" | |||||
} | |||||
result.add(timeStaticItem_1)*/ | |||||
/* //综合学习效率 | |||||
val timeStaticItem_2 = TimeStatisticItem().apply { | |||||
backGround = R.drawable.shape_rounder_4_theme_a5 | |||||
name = "综合学习效率" | |||||
unit = "%" | |||||
time = initShow(statistics.se) | |||||
initIncr(this,statistics.seIncr) | |||||
} | |||||
result.add(timeStaticItem_2) | |||||
//已学课程 | |||||
val timeStaticItem_3 = TimeStatisticItem().apply { | |||||
backGround = R.drawable.shape_rounder_4_green_a5 | |||||
name = "已学课程" | |||||
unit = "/${CourseManager.getTotalCourseSize()}个" | |||||
time = "${statistics.sc}" | |||||
initIncr(this,statistics.scIncr.toDouble()) | |||||
} | |||||
result.add(timeStaticItem_3) | |||||
//已学进度 | |||||
val timeStaticItem_4 = TimeStatisticItem().apply { | |||||
backGround = R.drawable.shape_rounder_4_purple_a5 | |||||
name = "已学进度" | |||||
unit = "%" | |||||
time = initShow(statistics.ts) | |||||
initIncr(this,statistics.tsIncr) | |||||
} | |||||
result.add(timeStaticItem_4)*/ | |||||
return result | return result | ||||
} | } | ||||