lmw
2024-06-17 f571288a24fcf10143dcc8015ffbbf38dbc0c614
app/src/main/java/com/dollearn/student/ui/home/ListenFragment.kt
@@ -49,11 +49,16 @@
                super.handleMessage(msg)
                when(msg.what){
                    PLAY_VOICE->{
                        if (iv_playing.visibility != View.VISIBLE)
                        val listenActivity = activity as ListenActivity
                        val indexOf = listenActivity.fragments.indexOf(this@ListenFragment) //当前题目序号
                        if (iv_playing.visibility != View.VISIBLE&&indexOf == listenActivity.viewPager.currentItem){ //没有播放并且是当前题号
                            player.startPlayMusic(requireContext(),correctVoice)
                            Log.e(TAG,"播放声音:$indexOf,${correctVoice}")
                        }
                    }
                    TO_NEXT->{
                        (requireActivity() as ListenActivity).next()
                        if (isAdded)
                            (requireActivity() as ListenActivity).next()
                    }
                }
            }
@@ -127,6 +132,7 @@
                myToast("请先听题")
                return@clickDelay
            }
            (activity as ListenActivity).totalCount ++
            if (!hasRight){
                v.progress = 0f
                v.transitionToEnd()
@@ -147,6 +153,7 @@
                    })
                }else{
                    hasRight = true
                    (activity as ListenActivity).rightCount ++
                    motion.transitionToEnd()
                    handler?.sendEmptyMessage(PLAY_VOICE)
                }