| | |
| | | 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() |
| | | } |
| | | } |
| | | } |
| | |
| | | myToast("请先听题") |
| | | return@clickDelay |
| | | } |
| | | (activity as ListenActivity).totalCount ++ |
| | | if (!hasRight){ |
| | | v.progress = 0f |
| | | v.transitionToEnd() |
| | |
| | | }) |
| | | }else{ |
| | | hasRight = true |
| | | (activity as ListenActivity).rightCount ++ |
| | | motion.transitionToEnd() |
| | | handler?.sendEmptyMessage(PLAY_VOICE) |
| | | } |