| | |
| | | import com.dollearn.student.network.entity.SubjectBean |
| | | import com.dollearn.student.network.request |
| | | import com.dollearn.student.ui.TransparentStatusBarActivity |
| | | import com.dollearn.student.utils.Const |
| | | import com.dollearn.student.utils.event.EmptyEvent |
| | | import kotlinx.android.synthetic.main.activity_listen.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | |
| | | class ChooseVoiceActivity:TransparentStatusBarActivity() { |
| | | override fun setContentView() = R.layout.activity_listen |
| | |
| | | ResultActivity.startResult(this,day,week,season,2,totalCount,rightCount,data!!.data.integral,time,data!!.data.id) |
| | | finish() |
| | | }else{ |
| | | (fragments[view_pager.currentItem+1] as ChooseVoiceFragment).recover() |
| | | view_pager.setCurrentItem(view_pager.currentItem+1,true) |
| | | tv_last.visible() |
| | | if (data!!.subjectList[view_pager.currentItem].filter { it.completed }.size == 4){ //防止多次调用触发 |
| | | (fragments[view_pager.currentItem+1] as ChooseVoiceFragment).recover() |
| | | view_pager.setCurrentItem(view_pager.currentItem+1,true) |
| | | tv_last.visible() |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | tipDialog.arguments = bundleOf("msg" to "未完成全部答题,确认退出吗?") |
| | | tipDialog.setCallback(object :TipDialog.OnClickCallback{ |
| | | override fun onOk() { |
| | | if (view_pager.currentItem == 0) |
| | | val list = (data?.subjectList?: arrayListOf()).subList(0,view_pager.currentItem).flatMap { it } |
| | | HttpManager.exitLearning(view_pager.currentItem,season,time,totalCount,rightCount,day,week,2,data?.data?.id?:"", list.joinToString(",") { it.id }).request(this@ChooseVoiceActivity){ _, _-> |
| | | finish() |
| | | else{ |
| | | val list = (data?.subjectList?: arrayListOf()).subList(0,view_pager.currentItem).flatMap { it } |
| | | HttpManager.exitLearning(view_pager.currentItem,season,time,totalCount,rightCount,day,week,2,data?.data?.id?:"", list.joinToString(",") { it.id }).request(this@ChooseVoiceActivity){ _, _-> |
| | | finish() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | override fun onDestroy() { |
| | | super.onDestroy() |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.STOP_TIMER)) |
| | | handler?.removeMessages(0) |
| | | handler = null |
| | | } |