From b6a22ac20c4155bb6f3df928cf5d88502079406c Mon Sep 17 00:00:00 2001 From: lmw <125975490@qq.com> Date: 星期一, 22 七月 2024 15:28:13 +0800 Subject: [PATCH] save --- app/src/main/java/com/dollearn/student/ui/home/IncludeFragment.kt | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/dollearn/student/ui/home/IncludeFragment.kt b/app/src/main/java/com/dollearn/student/ui/home/IncludeFragment.kt index c244512..320c3ea 100644 --- a/app/src/main/java/com/dollearn/student/ui/home/IncludeFragment.kt +++ b/app/src/main/java/com/dollearn/student/ui/home/IncludeFragment.kt @@ -48,7 +48,7 @@ private val act by lazy { requireActivity() as IncludeActivity } private var voiceIndex = -1 //点击播放的声音序号 0-5取值 - private val voiceViews by lazy { arrayListOf(cl_voice1,cl_voice2,cl_voice3,cl_voice4,cl_voice5,cl_voice6) } + private val voiceViews by lazy { arrayListOf(cl_voice1_real,cl_voice2_real,cl_voice3_real,cl_voice4_real,cl_voice5_real,cl_voice6_real) } private var playing = false private val answerImg = arrayListOf<String>() //随机答案图片 @@ -87,13 +87,23 @@ } data?.apply { val originList = subjectList[group] - iv_1.setImageURI(originList[0].img) - iv_2.setImageURI(originList[1].img) - iv_4.setImageURI(originList[3].img) answerImg.clear() answerImg.add(originList[2].img) answerImg.add(originList[4].img) answerImg.add(originList[5].img) + cl_voice1_real.postDelayed({ + iv_1.setImageURI(originList[0].img) + iv_2.setImageURI(originList[1].img) + iv_4.setImageURI(originList[3].img) + if (cl_1.width > dip(203)){ + voiceViews.forEach { + it.layoutParams.width = dip(159) + it.layoutParams.height = dip(52) + it.requestLayout() + } + } + voiceViews.forEach { it.visible() } + },500) } voiceViews.forEachIndexed { index, constraintLayout -> if (index == 0) @@ -111,11 +121,11 @@ private fun initClick() { voiceViews.forEachIndexed { index, constraintLayout -> - constraintLayout.clickDelay { + constraintLayout.setOnClickListener { if (!playing){ if (index!=0&&!data!!.subjectList[group][index-1].listend){ myToast("请按顺序听语音") - return@clickDelay + return@setOnClickListener } voiceIndex = index handler?.sendEmptyMessage(PLAY_VOICE) -- Gitblit v1.7.1