From f84c51bb2f6be93b1ff6e48077316eaabd713d9f Mon Sep 17 00:00:00 2001 From: lmw <125975490@qq.com> Date: 星期五, 07 三月 2025 13:51:51 +0800 Subject: [PATCH] save --- app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt b/app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt index d72618f..c898449 100644 --- a/app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt +++ b/app/src/main/java/com/dollearn/student/ui/home/ChooseVoiceFragment.kt @@ -58,6 +58,8 @@ private var nowVoiceView:View? = null + private val isShowText by lazy { SPUtils.instance().getBoolean(Const.IS_SHOW_TEXT,true) } + override fun onFirstVisibleToUser() { player.setOnAudioStatusUpdateListener(this) player.stopPlayMusic() @@ -117,7 +119,7 @@ } rl_check_1.clickDelay { - if (playing) + if (playing||data!!.subjectList[group].filter { it.completed }.size == data!!.subjectList[group].size) return@clickDelay if (rl_check_2.visibility == View.VISIBLE&&rl_check_3.visibility == View.VISIBLE){ dot_1.visible() @@ -143,7 +145,7 @@ } rl_check_2.clickDelay { - if (playing) + if (playing||data!!.subjectList[group].filter { it.completed }.size == data!!.subjectList[group].size) return@clickDelay if (rl_check_1.visibility == View.VISIBLE&&rl_check_3.visibility == View.VISIBLE) { dot_2.visible() @@ -170,7 +172,7 @@ } rl_check_3.clickDelay { - if (playing) + if (playing||data!!.subjectList[group].filter { it.completed }.size == data!!.subjectList[group].size) return@clickDelay if (rl_check_2.visibility == View.VISIBLE&&rl_check_3.visibility == View.VISIBLE) { dot_3.visible() @@ -243,15 +245,16 @@ val shuffledList = list.shuffled() voiceList.clear() voiceList.addAll(shuffledList) - nameViews.forEachIndexed { index, textView -> - if (index == currentIndex){ - textView.text = originList[index].name - textView.backgroundResource = R.color.textColor99 - }else{ - textView.text = "" - textView.backgroundResource = R.color.page_bg + if (isShowText) + nameViews.forEachIndexed { index, textView -> + if (index == currentIndex){ + textView.text = originList[index].name + textView.backgroundResource = R.color.textColor99 + }else{ + textView.text = "" + textView.backgroundResource = R.color.page_bg + } } - } //设置动画飞行路径 3对4 val rightVoiceIndex = voiceList.indexOf(imageNow.correct) var start = 0 @@ -441,4 +444,8 @@ player.stopPlayMusic() } + override fun onDestroy() { + super.onDestroy() + handler?.removeCallbacksAndMessages(null) + } } \ No newline at end of file -- Gitblit v1.7.1