Browse Source

exam

master
suliang 2 years ago
parent
commit
040d31e895
43 changed files with 833 additions and 152 deletions
  1. 6
    27
      .idea/codeStyles/Project.xml
  2. 7
    0
      .idea/copyright/profiles_settings.xml
  3. 3
    0
      .idea/dictionaries/suliang.xml
  4. 12
    1
      .idea/misc.xml
  5. 2
    0
      app/build.gradle
  6. 1
    0
      app/src/main/assets/voice.json
  7. 2
    2
      app/src/main/java/com/xkl/cdl/data/DataTransferHolder.kt
  8. 1
    0
      app/src/main/java/com/xkl/cdl/data/bean/course/Course.kt
  9. 1
    1
      app/src/main/java/com/xkl/cdl/data/bean/course/CourseDetail.kt
  10. 21
    0
      app/src/main/java/com/xkl/cdl/data/bean/course/DialogueSpokenItem.kt
  11. 39
    0
      app/src/main/java/com/xkl/cdl/data/bean/intentdata/ExamData.kt
  12. 12
    0
      app/src/main/java/com/xkl/cdl/data/manager/UserInfoManager.kt
  13. 1
    0
      app/src/main/java/com/xkl/cdl/data/manager/db/DbCoursePackManager.kt
  14. 4
    0
      app/src/main/java/com/xkl/cdl/module/XKLApplication.kt
  15. 48
    23
      app/src/main/java/com/xkl/cdl/module/learn/LearnExamActivity.kt
  16. 24
    0
      app/src/main/java/com/xkl/cdl/module/learn/LearnExamViewModel.kt
  17. 10
    0
      app/src/main/java/com/xkl/cdl/module/m_center_learn/coursechildren/CourseMainFragment.kt
  18. 13
    2
      app/src/main/java/com/xkl/cdl/module/m_center_learn/coursechildren/CourseTotalTestFragment.kt
  19. 6
    1
      app/src/main/java/com/xkl/cdl/module/splash/SplashActivity.kt
  20. 17
    0
      app/src/main/res/drawable/progress_statistics.xml
  21. 18
    0
      app/src/main/res/drawable/progressbar_countdown_time.xml
  22. 5
    0
      app/src/main/res/drawable/shape_rounder_8_stroke_gray1.xml
  23. 1
    1
      app/src/main/res/layout/activity_course_main.xml
  24. 63
    0
      app/src/main/res/layout/activity_learn_exam.xml
  25. 0
    15
      app/src/main/res/layout/activity_learn_exam_word.xml
  26. 5
    5
      app/src/main/res/layout/activity_main.xml
  27. 5
    5
      app/src/main/res/layout/dialog_lesson_learn.xml
  28. 88
    0
      app/src/main/res/layout/inc_exam_spell_content.xml
  29. 107
    0
      app/src/main/res/layout/inc_exam_word_choose_content.xml
  30. 38
    56
      app/src/main/res/layout/inc_learn_test_statistic.xml
  31. 6
    6
      app/src/main/res/layout/inc_learn_title.xml
  32. 2
    2
      app/src/main/res/layout/inc_over_number.xml
  33. 127
    0
      app/src/main/res/layout/includ_test_option_item.xml
  34. 1
    1
      app/src/main/res/layout/include_main_learn_center_course_progress.xml
  35. 1
    1
      app/src/main/res/layout/main_item_coursepack.xml
  36. 4
    1
      app/src/main/res/values/colors.xml
  37. 4
    1
      app/src/main/res/values/dimens.xml
  38. 3
    0
      app/src/main/res/values/strings.xml
  39. 20
    0
      app/svg/drawable/ic_right.xml
  40. 20
    0
      app/svg/drawable/ic_wrong.xml
  41. 5
    1
      build.gradle
  42. 2
    0
      lib/common/build.gradle
  43. 78
    0
      lib/common/src/main/java/com/suliang/common/util/SpUtils.kt

+ 6
- 27
.idea/codeStyles/Project.xml View File

@@ -1,32 +1,11 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ComposeCustomCodeStyleSettings>
<option name="USE_CUSTOM_FORMATTING_FOR_MODIFIERS" value="false" />
</ComposeCustomCodeStyleSettings>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<JavaCodeStyleSettings>
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="SPACE_AROUND_RANGE" value="true" />
<option name="SPACE_BEFORE_TYPE_COLON" value="true" />

+ 7
- 0
.idea/copyright/profiles_settings.xml View File

@@ -0,0 +1,7 @@
<component name="CopyrightManager">
<settings>
<LanguageOptions name="__TEMPLATE__">
<option name="relativeBefore" value="false" />
</LanguageOptions>
</settings>
</component>

+ 3
- 0
.idea/dictionaries/suliang.xml View File

@@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="suliang" />
</component>

+ 12
- 1
.idea/misc.xml View File

@@ -23,16 +23,21 @@
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/nav_service.xml" value="0.30520833333333336" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/nav_statistics.xml" value="0.1" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/progress_center.xml" value="0.287962962962963" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/progress_statistics.xml" value="0.4425925925925926" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/progressbar_countdown_time.xml" value="0.45740740740740743" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/shape_rounder_12_white.xml" value="0.5140625" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/shape_rounder_8_stroke_gray2.xml" value="0.48055555555555557" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/shape_rounder_toplr_24_white.xml" value="0.5061538461538462" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/shape_switch_thumb.xml" value="0.14074074074074075" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/spoken_autoplay_btn_text_color_.xml" value="0.5140625" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/switch_thumb_selector.xml" value="0.3768518518518518" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/switch_track_selector.xml" value="0.3768518518518518" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/test_error_state_button_bg.xml" value="0.45740740740740743" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/drawable/theme_splash_bg.xml" value="0.30520833333333336" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout-v23/include_main_learn_center_course_type_title.xml" value="0.4963768115942029" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_course_main.xml" value="0.33" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_learn_base.xml" value="0.4979166666666667" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_learn_exam.xml" value="0.23632218844984804" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_learn_exam_word.xml" value="0.33" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_learn_word2.xml" value="0.4979166666666667" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/activity_main.xml" value="0.5" />
@@ -50,8 +55,12 @@
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/fragment_first.xml" value="0.4979166666666667" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/fragment_learn_center.xml" value="0.25" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/fragment_my.xml" value="0.28229166666666666" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_learn_test_statistic.xml" value="0.35260416666666666" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_exam_spell_content.xml" value="0.45153985507246375" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_exam_word_choose_content.xml" value="0.45153985507246375" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_learn_test_statistic.xml" value="0.5" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_learn_title.xml" value="0.2373353596757852" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/inc_over_number.xml" value="0.4979166666666667" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/includ_test_option_item.xml" value="0.45153985507246375" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/include_main_learn_center_course_progress.xml" value="0.503125" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/include_main_learn_center_course_type_title.xml" value="0.67" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/src/main/res/layout/include_recyclerview_smart_refresh_layout.xml" value="0.4979166666666667" />
@@ -73,9 +82,11 @@
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_nav_my.xml" value="0.44166666666666665" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_nav_service.xml" value="0.21574074074074073" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_nav_statistics.xml" value="0.44166666666666665" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_right.xml" value="0.4425925925925926" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_spell.xml" value="0.5061538461538462" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_spoken.xml" value="0.5061538461538462" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_voice.xml" value="0.5061538461538462" />
<entry key="..\:/Work/XKL/XKL/XklLocal/app/svg/drawable/ic_wrong.xml" value="0.4425925925925926" />
<entry key="..\:/Work/XKL/XKL/XklLocal/lib/common/src/main/res/drawable/ic_back.xml" value="0.4148148148148148" />
<entry key="..\:/Work/XKL/XKL/XklLocal/lib/common/src/main/res/drawable/ic_search.xml" value="0.19814814814814816" />
<entry key="..\:/Work/XKL/XKL/XklLocal/lib/common/src/main/res/drawable/loading_bg.xml" value="0.5061538461538462" />

+ 2
- 0
app/build.gradle View File

@@ -96,5 +96,7 @@ dependencies {
implementation customDependencies.Lottie

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
//Gson
implementation customDependencies.Gson

}

+ 1
- 0
app/src/main/assets/voice.json
File diff suppressed because it is too large
View File


+ 2
- 2
app/src/main/java/com/xkl/cdl/data/DataTransferHolder.kt View File

@@ -22,7 +22,7 @@ class DataTransferHolder private constructor(){
* @param key String
* @param value T
*/
fun <T : Any> putData(key: String, value : T){
fun <T : Any> putData(key: String = AppConfig.INTENT_1, value : T){
dataMap[key] = value
}

@@ -32,7 +32,7 @@ class DataTransferHolder private constructor(){
* @return T
*/
@Suppress("UNCHECKED_CAST")
fun <T> getData(key : String) : T{
fun <T> getData(key : String = AppConfig.INTENT_1) : T{
return dataMap[key] as T
}


+ 1
- 0
app/src/main/java/com/xkl/cdl/data/bean/course/Course.kt View File

@@ -20,6 +20,7 @@ data class Course(
val coursePackId: Long,
val coursePackType: Int,
val courseId: Long,
val courseTitle : String,
val courseType: Int,
val totalWords: Int,
val dbPathName: String

+ 1
- 1
app/src/main/java/com/xkl/cdl/data/bean/course/CourseDetail.kt View File

@@ -17,7 +17,7 @@ class CourseDetail {
var right = hashMapOf<String, Int>() //正确条目数,key=>{chapter_id}_{lesson_id} value=>条目数量
var wrong: HashMap<String, Int> = hashMapOf() //错误条目数,key=>{chapter_id}_{lesson_id} value=>条目数量
var lesson_learn_point: HashMap<String, Long> = hashMapOf() //章节学习点 key=>{chapter_id}_{lesson_id} value=>{entity_id)
var exam_w_r_list: HashMap<String, bool> = hashMapOf() //课程/课时学前测试正确错误列表 key=> {chapter_id}_{lesson_id}_{entity_id} value=>正确 true;错误 false
var exam_w_r_list: HashMap<String, Boolean> = hashMapOf() //课程/课时学前测试正确错误列表 key=> {chapter_id}_{lesson_id}_{entity_id} value=>正确 true;错误 false
var course_learn_point: String = "" //课程学习进度点 {chapter_id}_{lesson_id}_{entity_id}



+ 21
- 0
app/src/main/java/com/xkl/cdl/data/bean/course/DialogueSpokenItem.kt View File

@@ -0,0 +1,21 @@
package com.xkl.cdl.data.bean.course

import com.google.gson.annotations.Expose
import java.io.Serializable

/**
* author suliang
* create 2021/9/9 17:49
* Describe: 口语 对话对应数据实体
*/
data class DialogueSpokenItem(val id: Int,
val s_id: Int,
val role: String,
val title: String,
@Expose var sentence: String,
@Expose val explaination: String,
@Expose val analysis: String?,
val sort: Int):Serializable {
//是否收藏 收藏的id 为0则为未收藏
var collectId : Long = 0
}

+ 39
- 0
app/src/main/java/com/xkl/cdl/data/bean/intentdata/ExamData.kt View File

@@ -0,0 +1,39 @@
package com.xkl.cdl.data.bean.intentdata

import com.xkl.cdl.data.bean.course.DialogueSpokenItem
import com.xkl.cdl.data.bean.course.ExamBean
import com.xkl.cdl.data.bean.course.Lesson
import kotlin.collections.HashMap

/**
* author suliang
* create 2022/4/8 12:01
* Describe: 测试传递数据
* 学前总测: coursePackType, courseType, testData ,mExamWRMap
* 学后总测: coursePackType, courseType, testData
* 课时学前测: coursePackType, courseType, testData ,mExamWRMap,lesson
* 课时学后测: coursePackType, courseType, testData ,lesson.
*
*/
data class ExamData(
val subjectId : Int, //项目类型
val examType : Int, //测试类型
val showTitle : String, //去测试本地显示名称,学前学后 为课程名称,课时前、后为课时名称
val saveTitle : String, //测试试卷上传名称 : 学习中心:课程名称 + “ ” + 学习类型 课程测试:课程名称 + “ ” 学习类型 + (章节拼接名称) 词汇量测试:词汇量测试:阶段名称
) {
var coursePackType:Int = 0 //课程包类型
var courseType : Int= 0 //课程类型
var testData : List<ExamBean>? = null //测试题数据
var lesson : Lesson? = null //课时测试时必传
// 课程/课时学前测试正确错误列表 key=> {chapter_id}_{lesson_id}_{entity_id} value=>正确 true;错误 false
var mExamWRMap : HashMap<String, Boolean>? = null
//学前总测试与章节前测试时学习错误集合
var newErrorMap : HashMap<String, Boolean> = hashMapOf()
//口语对话测试数据: 仅在口语对话课时后测试中使用该课时的学习数据
var allSentencesList : List<List<DialogueSpokenItem>>? = null
}

+ 12
- 0
app/src/main/java/com/xkl/cdl/data/manager/UserInfoManager.kt View File

@@ -0,0 +1,12 @@
package com.xkl.cdl.data.manager

/**
* author suliang
* create 2022/4/8 17:47
* Describe: 用户数据管理
*/
object UserInfoManager {



}

+ 1
- 0
app/src/main/java/com/xkl/cdl/data/manager/db/DbCoursePackManager.kt View File

@@ -60,6 +60,7 @@ class DbCoursePackManager {
coursePackId,
coursePackType,
cursor.getLong(0),
cursor.getString(2),
cursor.getInt(8),
cursor.getInt(9),
cursor.getString(10)

+ 4
- 0
app/src/main/java/com/xkl/cdl/module/XKLApplication.kt View File

@@ -2,6 +2,7 @@ package com.xkl.cdl.module

import android.app.Application
import com.suliang.common.util.LogUtil
import com.tencent.mmkv.MMKV
import net.sqlcipher.database.SQLiteDatabase
import java.util.*

@@ -17,6 +18,9 @@ class XKLApplication : Application() {
SQLiteDatabase.loadLibs(this)
// ImageLoader.mStrategy = GlideLoaderStrategy()
LogUtil.e(UUID.randomUUID().toString().replace("-",""))
val rootDir = MMKV.initialize(this)
LogUtil.e(rootDir)


}

+ 48
- 23
app/src/main/java/com/xkl/cdl/module/learn/LearnExamActivity.kt View File

@@ -1,16 +1,20 @@
package com.xkl.cdl.module.learn

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import androidx.viewbinding.ViewBinding
import com.suliang.common.AppConfig
import com.suliang.common.base.activity.BaseActivityVM
import com.suliang.common.base.activity.UIBaseActivity
import com.suliang.common.extension.click
import com.xkl.cdl.R
import com.xkl.cdl.data.AppConstants
import com.xkl.cdl.databinding.ActivityLearnExamWordBinding
import com.xkl.cdl.databinding.ActivityLearnSpellBinding
import com.xkl.cdl.databinding.*
import com.xkl.cdl.module.m_center_learn.CoursePackMainActivity

/**
@@ -18,7 +22,7 @@ import com.xkl.cdl.module.m_center_learn.CoursePackMainActivity
* create 2022/4/6 19:18
* Describe: 测试界面 总测 课时测
*/
class LearnExamActivity : UIBaseActivity() {
class LearnExamActivity : BaseActivityVM<ActivityLearnExamBinding,LearnExamViewModel>() {
companion object {
@JvmStatic
@@ -27,35 +31,56 @@ class LearnExamActivity : UIBaseActivity() {
}
}

//拼写内容binding
private lateinit var spellBinding : IncExamSpellContentBinding
//选项内容binding
private lateinit var wordChooseBinding : IncExamWordChooseContentBinding
/** 音频测试、单词测试布局 */
private var _normalBinding : ActivityLearnExamWordBinding? = null
/**布局 */
private var _spellBinding : ActivityLearnSpellBinding? = null
override fun setContentView() {
_normalBinding = ActivityLearnExamWordBinding.inflate(layoutInflater)
setContentView(_normalBinding!!.root)
override fun initViewModel() : LearnExamViewModel {
return ViewModelProvider(this)[LearnExamViewModel::class.java]
}
override fun initActivity(savedInstanceState : Bundle?) {
when(vm.intentData.courseType){
AppConstants.COURSE_TYPE_ENGLISH_SPELL -> {
spellBinding = IncExamSpellContentBinding.inflate(layoutInflater,binding.containerLayout,true)
}
else -> {
wordChooseBinding = IncExamWordChooseContentBinding.inflate(layoutInflater,binding.containerLayout,true)
}
}
initTitle()
}
@SuppressLint("SetTextI18n")
private fun initTitle(){
binding.incLearnTitle.run {
imgBack.click { onBack() }
//题目
tvTitle.text = vm.intentData.showTitle
//题目进度
tvNumProgress.text = "${vm.currentIndex+1}/${vm.testData.size}"
//默认发音
}
}
private fun setNumberProgress(){
}
override fun loadData() {
_normalBinding?.let {
it.incLearnTitle.voiceSwitch.soundWayChange.observe(this){
println("发音 --》 $it ")
}
it.incLearnTitle.voiceSwitch.setSoundWay(AppConstants.SOUND_TYPE_US)
}
}
/** 返回: 未结束提示弹窗 */
private fun onBack(){
finish()
}
}

+ 24
- 0
app/src/main/java/com/xkl/cdl/module/learn/LearnExamViewModel.kt View File

@@ -0,0 +1,24 @@
package com.xkl.cdl.module.learn

import com.suliang.common.base.viewmodel.BaseViewModel
import com.xkl.cdl.data.DataTransferHolder
import com.xkl.cdl.data.bean.course.DialogueSpokenItem
import com.xkl.cdl.data.bean.course.ExamBean
import com.xkl.cdl.data.bean.intentdata.ExamData

class LearnExamViewModel : BaseViewModel() {
//传递过来的测试数据
val intentData : ExamData = DataTransferHolder.instance.getData()
//测试题数据
val testData : List<ExamBean> by lazy {
intentData.testData!!
}
//口语测试题
val allSentencesList : List<List<DialogueSpokenItem>> by lazy {
intentData.allSentencesList!!
}
//当前测试题下标, 默认为-1,进度设置需要 + 1 ,以数字显示为当前正在做的题数,而非已完成数
var currentIndex = -1
}

+ 10
- 0
app/src/main/java/com/xkl/cdl/module/m_center_learn/coursechildren/CourseMainFragment.kt View File

@@ -9,8 +9,11 @@ import com.suliang.common.extension.replaceFragment
import com.suliang.common.util.LogUtil
import com.xkl.cdl.R
import com.xkl.cdl.data.AppConstants
import com.xkl.cdl.data.DataTransferHolder
import com.xkl.cdl.data.bean.intentdata.ExamData
import com.xkl.cdl.data.manager.db.DbControlBase
import com.xkl.cdl.databinding.FragmentCourseMainBinding
import com.xkl.cdl.module.learn.LearnExamActivity
import com.xkl.cdl.module.m_center_learn.CoursePackMainActivityViewModel

/**
@@ -88,6 +91,13 @@ class CourseMainFragment : BaseFragmentVM<FragmentCourseMainBinding, CourseMainF
}
}

/** 跳转测试 */
fun startExam(examData : ExamData){
DataTransferHolder.instance.putData(value = examData)
LearnExamActivity.newInstance(requireContext())
}




+ 13
- 2
app/src/main/java/com/xkl/cdl/module/m_center_learn/coursechildren/CourseTotalTestFragment.kt View File

@@ -9,7 +9,9 @@ import com.suliang.common.extension.click
import com.suliang.common.extension.setHtml
import com.xkl.cdl.R
import com.xkl.cdl.data.AppConstants
import com.xkl.cdl.data.DataTransferHolder
import com.xkl.cdl.data.bean.course.ExamBean
import com.xkl.cdl.data.bean.intentdata.ExamData
import com.xkl.cdl.data.manager.CourseManager
import com.xkl.cdl.databinding.FragmentCourseTotalTestBinding
import com.xkl.cdl.module.learn.LearnExamActivity
@@ -147,9 +149,18 @@ class CourseTotalTestFragment : BaseFragmentVM<FragmentCourseTotalTestBinding, C
(requireParentFragment() as CourseMainFragment).changeFragment(1)
}

/** 开始测试 */
/** 开始测试 : 生成测试题,跳转到测试
*
*/
private fun startTest(view: View) {
LearnExamActivity.newInstance(requireContext())
//生成数据
val examData = ExamData(vm.course.subjectId, totalTestType, vm.course.courseTitle, vm.course.courseTitle).apply {
coursePackType = vm.course.coursePackType
courseType = vm.course.courseType
this.testData = this@CourseTotalTestFragment.testData
mExamWRMap = if (examType == AppConstants.TEST_TYPE_AFTER_TOTAL) vm.courseDetail.exam_w_r_list else null
}
(parentFragment as CourseMainFragment).startExam(examData)
}

}

+ 6
- 1
app/src/main/java/com/xkl/cdl/module/splash/SplashActivity.kt View File

@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.os.Bundle
import com.suliang.common.base.activity.BaseActivity
import com.suliang.common.util.LogUtil
import com.suliang.common.util.SpUtils
import com.suliang.common.util.file.FileUtil
import com.suliang.common.util.thread.AppExecutors
import com.xkl.cdl.data.manager.CourseManager
@@ -49,7 +50,11 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(){
// show(supportFragmentManager,javaClass.name)
// }
// LogUtil.e("Dialog -- > ${learnDialog.hashCode()}")
// if (true) return
SpUtils.instance.encode("my","abcdefgxxxxx")
SpUtils.instance.remove("my")
println(SpUtils.instance.decode("my",String::class.java))

if (true) return


showHideLoading(true)

+ 17
- 0
app/src/main/res/drawable/progress_statistics.xml View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@color/gray_1"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@color/theme_color"/>
</shape>
</clip>
</item>
</layer-list>

+ 18
- 0
app/src/main/res/drawable/progressbar_countdown_time.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--水平进度条颜色-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@color/gray_1"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@color/red_3"/>
</shape>
</clip>
</item>
</layer-list>

+ 5
- 0
app/src/main/res/drawable/shape_rounder_8_stroke_gray1.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/gray_1" android:width="1dp"/>
<corners android:radius="8dp"/>
</shape>

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

@@ -102,7 +102,7 @@
android:gravity="center"
android:text="@string/introduction"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintBottom_toBottomOf="@+id/img_course_pack_cover"
app:layout_constraintEnd_toEndOf="parent" />


+ 63
- 0
app/src/main/res/layout/activity_learn_exam.xml View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".module.learn.LearnExamActivity">

<include
android:id="@+id/inc_learn_title"
layout="@layout/inc_learn_title" />

<include
android:id="@+id/inc_statistics"
layout="@layout/inc_learn_test_statistic" />

<FrameLayout
android:id="@+id/container_layout"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inc_statistics"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/tv_error_state">

<!-- 拼写的显示内容-->
<!-- <include layout="@layout/inc_exam_spell_content" />-->
<!--四选一显示内容
<include layout="@layout/inc_exam_word_choose_content" />-->


</FrameLayout>

<com.google.android.material.button.MaterialButton
android:id="@+id/tv_error_state"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="0dp"
android:layout_height="44dp"
android:insetTop="0dp"
android:insetBottom="0dp"
android:layout_gravity="center"
android:layout_marginStart="105dp"
android:layout_marginEnd="105dp"
android:gravity="center"
android:text="@string/pause"
android:textSize="@dimen/smallSize"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginBottom="40dp"
app:cornerRadius="8dp"
android:backgroundTint="@color/gray_4" />

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

+ 0
- 15
app/src/main/res/layout/activity_learn_exam_word.xml View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".module.learn.LearnExamActivity">

<include
android:id="@+id/inc_learn_title"
layout="@layout/inc_learn_title" />


</androidx.constraintlayout.widget.ConstraintLayout>

+ 5
- 5
app/src/main/res/layout/activity_main.xml View File

@@ -49,7 +49,7 @@
app:drawableTopCompat="@drawable/ic_nav_memo"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
android:paddingTop="4dp"
app:drawableTint="@color/nav_check_color"
android:textColor="@color/nav_check_color"
@@ -63,7 +63,7 @@
android:drawableTop="@drawable/ic_nav_statistics"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
android:paddingTop="4dp"
android:button="@null"
app:drawableTint="@color/nav_check_color"
@@ -77,7 +77,7 @@
app:drawableTopCompat="@drawable/ic_nav_learn_center"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
android:paddingTop="4dp"
android:button="@null"
app:drawableTint="@color/nav_check_color"
@@ -91,7 +91,7 @@
app:drawableTopCompat="@drawable/ic_nav_memo"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
android:paddingTop="4dp"
android:button="@null"
app:drawableTint="@color/nav_check_color"
@@ -105,7 +105,7 @@
app:drawableTopCompat="@drawable/ic_nav_my"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
android:paddingTop="4dp"
android:button="@null"
app:drawableTint="@color/nav_check_color"

+ 5
- 5
app/src/main/res/layout/dialog_lesson_learn.xml View File

@@ -55,7 +55,7 @@
android:layout_height="wrap_content"
android:text="@string/current_test_score"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintEnd_toEndOf="@+id/tv_score"
app:layout_constraintStart_toStartOf="@+id/tv_score"
app:layout_constraintTop_toBottomOf="@+id/tv_score"
@@ -85,7 +85,7 @@
android:paddingStart="@dimen/global_spacing"
android:paddingEnd="@dimen/global_spacing"
android:textColor="@color/theme_color"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title"
@@ -97,7 +97,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_lesson_name"
@@ -109,7 +109,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title"
@@ -134,7 +134,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:barrierMargin="@dimen/miniSize"
app:barrierMargin="@dimen/smallerSize"
app:constraint_referenced_ids="tv_count_time,inc_statistics_number" />

<View

+ 88
- 0
app/src/main/res/layout/inc_exam_spell_content.xml View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- tools:showIn="@layout/activity_learn_exam_word"-->
<!--释义-->
<TextView
android:id="@+id/tv_explain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="【中】a.逐渐的;逐步的;和缓的"
android:textColor="@color/main_text_color"
android:textSize="@dimen/bigSize"
android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="34dp"
android:textStyle="bold" />

<!--单词测试时间-->
<ProgressBar
android:id="@+id/progress_word_countdown_time"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_marginLeft="88dp"
android:layout_marginTop="16dp"
android:layout_marginRight="87dp"
android:progressDrawable="@drawable/progressbar_countdown_time"
app:layout_constraintTop_toBottomOf="@+id/tv_explain"
tools:progress="20" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_word"
android:layout_width="match_parent"
android:layout_height="@dimen/height_word"
android:layout_marginTop="@dimen/global_spacing"
android:gravity="center"
tools:text="gradual"
tools:textColor="@color/num0"
android:textSize="@dimen/size_max_word"
app:autoSizeMaxTextSize="@dimen/size_max_word"
app:autoSizeMinTextSize="@dimen/miniSize"
app:autoSizeStepGranularity="1dp"
app:autoSizeTextType="uniform"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progress_word_countdown_time" />

<TextView
android:id="@+id/tv_rule_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/test_spell_tip"
android:textColor="@color/gray_2"
android:textSize="@dimen/smallerSize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_word" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/spell_recyclerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@color/red_3"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_rule_tip"
android:layout_marginTop="12dp"
app:layout_constrainedWidth="true" />


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

+ 107
- 0
app/src/main/res/layout/inc_exam_word_choose_content.xml View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- tools:showIn="@layout/activity_learn_exam_word"-->
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/iv_voice"
android:layout_width="@dimen/height_word"
android:layout_height="@dimen/height_word"
android:layout_marginTop="10dp"
app:lottie_fileName="voice.json"
app:lottie_loop="true"
app:lottie_autoPlay="false"
app:lottie_repeatMode="restart"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_word"
android:layout_width="0dp"
android:layout_height="@dimen/height_word"
android:layout_marginTop="10dp"
android:gravity="center"
tools:text="gradual"
tools:textColor="@color/num0"
android:textSize="@dimen/size_max_word"
app:autoSizeMaxTextSize="@dimen/size_max_word"
app:autoSizeMinTextSize="@dimen/miniSize"
app:autoSizeStepGranularity="1dp"
app:autoSizeTextType="uniform"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<TextView
android:id="@+id/tv_rule_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/test_tip"
android:textColor="@color/gray_2"
android:textSize="@dimen/smallerSize"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_word" />

<include
android:id="@+id/inc_a"
layout="@layout/includ_test_option_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/global_spacing"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/global_spacing"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_rule_tip" />

<include
android:id="@+id/inc_b"
layout="@layout/includ_test_option_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/global_spacing"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/global_spacing"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inc_a" />

<include
android:id="@+id/inc_c"
layout="@layout/includ_test_option_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/global_spacing"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/global_spacing"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inc_b" />

<include
android:id="@+id/inc_d"
layout="@layout/includ_test_option_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/global_spacing"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/global_spacing"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inc_c" />


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

+ 38
- 56
app/src/main/res/layout/inc_learn_test_statistic.xml View File

@@ -3,109 +3,91 @@
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data>
<variable
name="examType"
type="Long" />
<variable
name="totalNum"
type="Long" />
<variable
name="progressNum"
type="Integer" />
<!--时间 : 毫秒-->
<variable
name="time"
type="Long" />
<variable
name="correctNum"
type="Long" />
<variable
name="errorNum"
type="Long" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".ui.mainlearncenter.com_fragment.TestingStatisticFragment">

android:layout_height="36dp"
tools:context=".ui.mainlearncenter.com_fragment.TestingStatisticFragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inc_learn_title"
tools:showIn="@layout/activity_learn_exam">

<!--测试数量进度-->
<ProgressBar
android:id="@+id/progress_test_number"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_2"
android:layout_height="2dp"
android:indeterminateOnly="false"
app:layout_constraintTop_toTopOf="parent"
android:progressDrawable="@drawable/progress_statistics"
android:max="@{(int)totalNum}"
android:progress="@{progressNum}"/>
android:progressDrawable="@drawable/progress_statistics"/>

<!--错误数量-->
<TextView
android:id="@+id/tv_error_number"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_34"
android:textSize="@dimen/dp_12"
android:textColor="@color/color_6"
android:drawablePadding="@dimen/dp_2"
android:layout_height="wrap_content"
android:textSize="@dimen/smallerSize"
android:textColor="@color/gray_2"
android:drawablePadding="2dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progress_test_number"
android:drawableLeft="@mipmap/test_error_icon"
android:text="@{@string/error_number_format(errorNum)}"
android:layout_marginRight="@dimen/dp_16"
android:gravity="center"/>
app:layout_constraintBottom_toBottomOf="parent"
tools:text="错误:100"
android:layout_marginEnd="@dimen/global_spacing"
android:gravity="center"
app:drawableLeftCompat="@drawable/ic_wrong" />

<!--正确数量-->
<TextView
android:id="@+id/tv_correct_number"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_34"
android:textSize="@dimen/dp_12"
android:textColor="@color/color_6"
android:drawableLeft="@mipmap/test_right_icon"
android:drawablePadding="@dimen/dp_2"
android:layout_height="wrap_content"
android:textSize="@dimen/smallerSize"
android:textColor="@color/gray_2"
android:drawablePadding="2dp"
app:layout_constraintRight_toLeftOf="@+id/tv_error_number"
app:layout_constraintTop_toBottomOf="@+id/progress_test_number"
android:text="@{@string/correct_number_foramt(correctNum)}"
android:layout_marginRight="@dimen/dp_16"
android:gravity="center" />
app:layout_constraintBottom_toBottomOf="parent"
tools:text="正确:100"
android:layout_marginEnd="@dimen/global_spacing"
android:gravity="center"
app:drawableLeftCompat="@drawable/ic_right" />

<!--测试类型-->
<TextView
android:id="@+id/tv_test_type_name"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_34"
android:textSize="@dimen/dp_12"
android:textColor="@color/color_6"
android:drawablePadding="@dimen/dp_2"
android:layout_height="wrap_content"
android:textSize="@dimen/smallerSize"
android:textColor="@color/gray_2"
android:drawablePadding="2dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progress_test_number"
tools:text="学后总测试"
android:gravity="center"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_16"
android:layout_marginLeft="@dimen/global_spacing"
android:layout_marginRight="@dimen/global_spacing"
app:layout_constraintBottom_toBottomOf="parent"
android:singleLine="true"
android:maxEms="6"
android:ellipsize="end"
app:learnTestExamType="@{examType}"
/>

<!--测试时间-->
<TextView
android:id="@+id/tv_test_time"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_34"
android:textSize="@dimen/dp_12"
android:textColor="@color/color_6"
android:layout_height="wrap_content"
android:textSize="@dimen/smallerSize"
android:textColor="@color/gray_2"
tools:text="00:00:00"
app:statisticsTotalTime="@{time}"
android:gravity="center"
app:layout_constraintLeft_toRightOf="@+id/tv_test_type_name"
app:layout_constraintTop_toBottomOf="@+id/progress_test_number"
android:layout_marginLeft="@dimen/dp_16"/>
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/global_spacing"/>


</androidx.constraintlayout.widget.ConstraintLayout>

+ 6
- 6
app/src/main/res/layout/inc_learn_title.xml View File

@@ -7,7 +7,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:showIn="@layout/activity_learn_exam_word">
tools:showIn="@layout/activity_learn_exam">

<ImageView
android:id="@+id/img_back"
@@ -28,7 +28,7 @@
android:layout_marginStart="66dp"
android:ellipsize="end"
android:maxLines="1"
android:text="小学英语单词课程小学英语单词课程小学英语单词课程"
tools:text="小学英语单词课程小学英语单词课程小学英语单词课程"
android:textColor="@color/main_text_color"
android:textSize="@dimen/bigSize"
android:textStyle="bold"
@@ -44,11 +44,11 @@
android:id="@+id/tv_num_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="66dp"
android:text="90/100"
android:layout_marginStart="2dp"
android:layout_marginEnd="70dp"
tools:text="90/100"
android:textColor="@color/main_text_color"
android:textSize="@dimen/bigSize"
android:textSize="@dimen/normalSize"
android:textStyle="bold"
android:visibility="visible"
app:layout_constrainedWidth="true"

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

@@ -28,7 +28,7 @@
android:layout_marginRight="28dp"
android:text="@string/correct"
android:textColor="@color/main_text_color"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintEnd_toEndOf="@+id/guideline_1"
app:layout_constraintTop_toTopOf="parent" />

@@ -40,7 +40,7 @@
android:layout_marginTop="8dp"
android:text="@string/error"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintStart_toEndOf="@+id/guideline_1"
app:layout_constraintTop_toTopOf="parent" />


+ 127
- 0
app/src/main/res/layout/includ_test_option_item.xml View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

</data>


<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_rounder_8_stroke_gray1"
android:minHeight="80dp"
android:paddingLeft="12dp"
android:paddingRight="8dp">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />

<!--口语总测试,发音部分区域-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_lottie_voice_area"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="6dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/iv_statu"
app:layout_constraintStart_toEndOf="@+id/guide_line"
app:layout_constraintTop_toTopOf="parent"
android:clickable="true"
android:focusable="true">

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/iv_option"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:lottie_autoPlay="false"
app:lottie_fileName="voice.json"
app:lottie_loop="true"
app:lottie_repeatMode="restart" />
</androidx.constraintlayout.widget.ConstraintLayout>

<!--口语总测试,选择项部分-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_choose_area"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="6dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guide_line"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:clickable="true"
android:focusable="true">

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/ic_right"/>

</androidx.constraintlayout.widget.ConstraintLayout>

<!--口语总测试,音频选项时的选项选择-->
<androidx.constraintlayout.widget.Group
android:id="@+id/group_voice_choose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="layout_choose_area,layout_lottie_voice_area,guide_line"
android:visibility="gone"/>


<TextView
android:id="@+id/tv_lable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/main_text_color"
android:textSize="@dimen/normalSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="A" />


<TextView
android:id="@+id/tv_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:textColor="@color/main_text_color"
android:textSize="@dimen/smallSize"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tv_lable"
app:layout_constraintRight_toLeftOf="@id/iv_statu"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginRight="36dp"
tools:text="喜好;爱好;类似的人(或物);(尤指被视为和某人或某事物一样好的)种类,类型 adj.类似的;相似的 adv.大概,可能;" />

<ImageView
android:id="@+id/iv_statu"
android:layout_width="28dp"
android:layout_height="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_right"
app:tint="@color/green_1"/>


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

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

@@ -21,7 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/theme_color"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

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

@@ -128,7 +128,7 @@
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/gray_2"
android:textSize="@dimen/miniSize"
android:textSize="@dimen/smallerSize"
app:coursePackLearnProgressFormat="@{coursePack.learnProgress}"/>
</com.xkl.cdl.widget.MyRankingView>


+ 4
- 1
app/src/main/res/values/colors.xml View File

@@ -20,13 +20,16 @@
<color name="translation">#00000000</color>
<color name="gray_1">#FFE6E6E6</color>
<color name="gray_2">#8A8A99</color>
<color name="gray_3">#FAFAFA</color>
<color name="gray_4">#666D80</color>
<color name="white">#FFFFFFFF</color>
<color name="white_1">#FFF5F5F5</color>
<color name="blue_1">#52CC52</color>
<color name="gray_3">#FAFAFA</color>
<color name="green_1">#40A540</color>
<color name="red_1">#FFF26255</color>
<color name="red_2">#F7874F</color>
<color name="red_3">#FF0000</color>



<color name="num0">#E50213</color>

+ 4
- 1
app/src/main/res/values/dimens.xml View File

@@ -3,7 +3,8 @@
<dimen name="nav_bottom_height">50dp</dimen>
<dimen name="line_height">0.5dp</dimen>

<dimen name="miniSize">12dp</dimen>
<dimen name="miniSize">8dp</dimen>
<dimen name="smallerSize">12dp</dimen>
<dimen name="smallSize">14dp</dimen>
<dimen name="normalSize">16dp</dimen>
<dimen name="bigSize">18dp</dimen>
@@ -13,6 +14,8 @@
<dimen name="common_button_height">44dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="common_dialog_width">300dp</dimen>
<dimen name="height_word">60dp</dimen>
<dimen name="size_max_word">42dp</dimen>


</resources>

+ 3
- 0
app/src/main/res/values/strings.xml View File

@@ -56,5 +56,8 @@
<string name="correct">正确</string>
<string name="error">错误</string>
<string name="start_learn">开始学习</string>
<string name="test_spell_tip">请从左至右依次点击选择正确的选项</string>
<string name="pause">暂停</string>
<string name="test_tip">请选择本单词正确的意义栏</string>

</resources>

+ 20
- 0
app/svg/drawable/ic_right.xml View File

@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M0,0h16v16h-16z"
android:strokeAlpha="0"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillType="nonZero"
android:strokeColor="#00000000"
android:fillAlpha="0"/>
<path
android:pathData="M8,1.6C4.464,1.6 1.6,4.464 1.6,8C1.6,11.536 4.464,14.4 8,14.4C11.536,14.4 14.4,11.536 14.4,8C14.4,4.464 11.536,1.6 8,1.6ZM12.088,5.848L7.304,10.632L7.032,10.904C6.744,11.192 6.288,11.192 6,10.904L5.728,10.632L3.888,8.792C3.648,8.552 3.672,8.152 3.952,7.952C4.176,7.792 4.488,7.824 4.68,8.024L6.52,9.84L11.312,5.048C11.552,4.808 11.952,4.832 12.152,5.112C12.32,5.344 12.288,5.656 12.088,5.848Z"
android:strokeWidth="1"
android:fillColor="#CCCCCC"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

+ 20
- 0
app/svg/drawable/ic_wrong.xml View File

@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M0,0h16v16h-16z"
android:strokeAlpha="0"
android:strokeWidth="1"
android:fillColor="#000000"
android:fillType="nonZero"
android:strokeColor="#00000000"
android:fillAlpha="0"/>
<path
android:pathData="M8,1.6C4.48,1.6 1.6,4.48 1.6,8C1.6,11.52 4.48,14.4 8,14.4C11.52,14.4 14.4,11.52 14.4,8C14.4,4.48 11.52,1.6 8,1.6ZM10.88,10.08C11.12,10.32 11.12,10.64 10.88,10.88C10.64,11.12 10.32,11.12 10.08,10.88L8,8.8L5.92,10.88C5.68,11.12 5.36,11.12 5.12,10.88C4.88,10.64 4.88,10.32 5.12,10.08L7.2,8L5.12,5.92C4.88,5.68 4.88,5.36 5.12,5.12C5.36,4.88 5.68,4.88 5.92,5.12L8,7.2L10.08,5.12C10.32,4.88 10.64,4.88 10.88,5.12C11.12,5.36 11.12,5.68 10.88,5.92L8.8,8L10.88,10.08Z"
android:strokeWidth="1"
android:fillColor="#CCCCCC"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

+ 5
- 1
build.gradle View File

@@ -85,7 +85,11 @@ ext {
Lottie : "com.airbnb.android:lottie:5.0.3",
//Rxjava RxAndroid
RxJava : "io.reactivex.rxjava3:rxjava:3.1.4",
RxAndroid: "io.reactivex.rxjava3:rxandroid:3.0.0"
RxAndroid: "io.reactivex.rxjava3:rxandroid:3.0.0",
//gson https://github.com/google/gson
Gson : "com.google.code.gson:gson:2.9.0",
//MMKV https://github.com/Tencent/MMKV/wiki/android_tutorial_cn
MMKV : "com.tencent:mmkv:1.2.13"
]



+ 2
- 0
lib/common/build.gradle View File

@@ -65,6 +65,8 @@ dependencies {
api customDependencies.RxJava
api customDependencies.RxAndroid
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
//MMKV
api customDependencies.MMKV




+ 78
- 0
lib/common/src/main/java/com/suliang/common/util/SpUtils.kt View File

@@ -0,0 +1,78 @@
package com.suliang.common.util

import android.os.Parcelable
import com.tencent.mmkv.MMKV

/**
* author suliang
* create 2022/4/8 18:36
* Describe: 数据保存,使用的mmkv
*/
class SpUtils {
companion object{
val instance by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
SpUtils()
}
}
private val kv : MMKV = MMKV.defaultMMKV()
/**
* 存放java基础语言类型: Boolean Int Long Float Double byte[]
* @param key String
* @param value Any
*/
fun encode(key:String, value:Any){
when(value){
is Boolean -> kv.encode(key,value)
is Int -> kv.encode(key,value)
is Long -> kv.encode(key,value)
is Float -> kv.encode(key,value)
is Double -> kv.encode(key,value)
is String -> kv.encode(key,value)
}
}
fun encode(key:String, value: Set<String>){
kv.encode(key,value)
}
fun <T: Parcelable> encode(key: String, value : T){
kv.encode(key,value)
}
fun <T> decode(key : String, c : Class<T> ) : T{
return when(c){
Int::class.java -> kv.decodeInt(key,-1)
Long::class.java -> kv.decodeLong(key,-1)
Float::class.java -> kv.decodeFloat(key,-1.0f)
Double::class.java -> kv.decodeDouble(key,-1.0)
String::class.java -> kv.decodeString(key,"")
else -> kv.decodeBool(key,false)
} as T
}
fun <T:Parcelable> decode(key:String, c : Class<T>): T? {
return kv.decodeParcelable(key,c)
}
fun decodeStringSet(key:String): Set<String>?{
return kv.decodeStringSet(key)
}
fun remove(key:String){
kv.removeValueForKey(key)
}
fun containsKey(key:String): Boolean = kv.containsKey(key)
fun clear(){
kv.clearAll()
}
}

Loading…
Cancel
Save