| | |
| | | import com.dollearn.student.ui.home.adapter.GameAdapter |
| | | import com.dollearn.student.utils.AudioUtils |
| | | import com.dollearn.student.utils.Const |
| | | import com.dollearn.student.utils.event.EmptyEvent |
| | | import com.dollearn.student.utils.interfaces.StringCallback |
| | | import kotlinx.android.synthetic.main.activity_super_listen.* |
| | | import kotlinx.android.synthetic.main.fragmetn_look_img.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | |
| | | class SuperListenActivity : TransparentStatusBarActivity(), AudioUtils.OnAudioStatusUpdateListener { |
| | | override fun setContentView() = R.layout.activity_super_listen |
| | |
| | | private var TIME = 10 //每题答题时间 |
| | | private var countTime = 0 //倒计时计数 |
| | | |
| | | var totalCount = 0 //总答题次数 |
| | | var rightCount = 0 //正确答题次数 |
| | | var time = 0 //学习秒数 |
| | | |
| | |
| | | override fun initClick() { |
| | | tv_exit.setOnClickListener { |
| | | if (tv_exit.text == "提交"){ |
| | | ResultActivity.startResult(this,0,0,0,6,totalCount,rightCount,list.filter { it.right }.sumBy { 1 },time,data!!.data.id,difficulty) |
| | | ResultActivity.startResult(this,0,0,0,6,list.size,rightCount,list.filter { it.right }.sumBy { 1 },time,data!!.data.id,difficulty) |
| | | finish() |
| | | }else |
| | | onBackPressed() |
| | |
| | | } |
| | | |
| | | private fun refreshUi() { |
| | | cl_voice.visible() |
| | | tv_sort.visible() |
| | | tv_exit.visible() |
| | | tv_tip.text = "准备听题" |
| | | rv_list.layoutManager = GridLayoutManager(this,5) |
| | | list.clear() |
| | | list.addAll(data?.subjectList?: arrayListOf()) |
| | |
| | | countTime = TIME //重置答题时间 |
| | | tv_tip.text = "准备听题" |
| | | state = 0 |
| | | handler?.sendEmptyMessageDelayed(PLAY_VOICE,3000) |
| | | handler?.sendEmptyMessageDelayed(PLAY_VOICE,if (index == 0) 200 else 3000) |
| | | }else{ |
| | | tv_sort.visibility = View.INVISIBLE |
| | | tv_tip.text = "" |
| | |
| | | override fun onDestroy() { |
| | | super.onDestroy() |
| | | handler?.removeCallbacksAndMessages(null) |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.STOP_TIMER)) |
| | | } |
| | | |
| | | override fun onPause() { |