| | |
| | | } |
| | | iv_today.setOnClickListener { |
| | | if (today!=null){ |
| | | showDialog() |
| | | HttpManager.getMeditationDetails(today!!.meditationId).requestByF(this,success = {_,data-> |
| | | dismissDialog() |
| | | MainActivity.voice = data |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.START_THINK)) |
| | | }){_,_-> |
| | | dismissDialog() |
| | | if (MainActivity.voice?.id == today?.meditationId){ |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.PAUSE_OR_RESUME_THINK)) |
| | | if (MainActivity.playing) //播放中 |
| | | iv_play_today.setImageResource(R.mipmap.player_pause) |
| | | else |
| | | iv_play_today.setImageResource(R.mipmap.play) |
| | | }else{ |
| | | showDialog() |
| | | HttpManager.getMeditationDetails(today!!.meditationId).requestByF(this,success = {_,data-> |
| | | dismissDialog() |
| | | if (MainActivity.playing) |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.FINISH_THINK)) |
| | | MainActivity.voice = data |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.START_THINK)) |
| | | }){_,_-> |
| | | dismissDialog() |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | iv_daily_empty.visible() |
| | | }else{ |
| | | iv_daily_empty.gone() |
| | | iv_today.setImageURI(today?.clientMeditationVO?.backgroundUrl) |
| | | iv_today.setImageURI(today?.imageUrl) |
| | | tv_length_today.text = "${today?.clientMeditationVO?.meditationTitle?.ellipsize(12)} | ${"%02d:%02d".format((data?.time?:0)/60,(data?.time?:0)%60)}" |
| | | tv_today_count.text = "${today?.clientMeditationVO?.realLearnedNum}人已参加学习" |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun refreshTodayPlayingState(){ |
| | | if (MainActivity.voice?.id == today?.meditationId&&MainActivity.playing) |
| | | iv_play_today.setImageResource(R.mipmap.player_pause) |
| | | else |
| | | iv_play_today.setImageResource(R.mipmap.play) |
| | | |
| | | } |
| | | |
| | | fun getPrivacy() { |
| | | if (!SPUtils.instance().getString(Const.User.TOKEN).isNullOrEmpty()) { |
| | | gp_pri_empty.gone() |
| | | HttpManager.getPersonalityPlan().requestByF(this){_,data-> |
| | | privacy.clear() |
| | | privacy.addAll(data?: arrayListOf()) |
| | | privacyAdapter.notifyDataSetChanged() |
| | | } |
| | | }else |
| | | gp_pri_empty.visible() |
| | | HttpManager.getPersonalityPlan().requestByF(this){_,data-> |
| | | privacy.clear() |
| | | privacy.addAll(data?: arrayListOf()) |
| | | privacyAdapter.notifyDataSetChanged() |
| | | } |
| | | } |
| | | |
| | | private fun getList() { |