| | |
| | | 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 IncludeActivity:TransparentStatusBarActivity() { |
| | | override fun setContentView() = R.layout.activity_listen |
| | |
| | | tipDialog.arguments = bundleOf("msg" to "未完成全部答题,确认退出吗?") |
| | | tipDialog.setCallback(object :TipDialog.OnClickCallback{ |
| | | override fun onOk() { |
| | | if (view_pager.currentItem == 0) |
| | | finish() |
| | | else{ |
| | | val list = (data?.subjectList?.subList(0,view_pager.currentItem)) |
| | | val arrayListOf = arrayListOf<Subject>() |
| | | list?.forEach { it -> |
| | | it.forEachIndexed { index, subject -> |
| | | if (index == 2||index == 4||index == 5){ |
| | | arrayListOf.add(subject) |
| | | } |
| | | val list = (data?.subjectList?.subList(0,view_pager.currentItem)) |
| | | val arrayListOf = arrayListOf<Subject>() |
| | | list?.forEach { it -> |
| | | it.forEachIndexed { index, subject -> |
| | | if (index == 2||index == 4||index == 5){ |
| | | arrayListOf.add(subject) |
| | | } |
| | | } |
| | | HttpManager.exitLearning(view_pager.currentItem,season,time,totalCount,rightCount,day,week,3,data?.data?.id?:"", arrayListOf.joinToString(",") { it.id }).request(this@IncludeActivity){ _, _-> |
| | | finish() |
| | | } |
| | | } |
| | | HttpManager.exitLearning(view_pager.currentItem,season,time,totalCount,rightCount,day,week,3,data?.data?.id?:"", arrayListOf.joinToString(",") { it.id }).request(this@IncludeActivity){ _, _-> |
| | | finish() |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | override fun onDestroy() { |
| | | super.onDestroy() |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.STOP_TIMER)) |
| | | handler?.removeMessages(0) |
| | | handler = null |
| | | } |