| | |
| | | import com.sinata.xqmuse.ui.home.adapter.HomeBannerAdapter |
| | | import com.sinata.xqmuse.ui.home.adapter.TopMenuAdapter |
| | | import com.sinata.xqmuse.ui.login.LoginActivity |
| | | import com.sinata.xqmuse.ui.mine.VipActivity |
| | | import com.sinata.xqmuse.utils.Const |
| | | import com.sinata.xqmuse.utils.event.EmptyEvent |
| | | import com.sinata.xqmuse.utils.interfaces.StringCallback |
| | | import kotlinx.android.synthetic.main.fragment_home.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.support.v4.startActivity |
| | | import org.jetbrains.anko.support.v4.toast |
| | | |
| | |
| | | getList() |
| | | getBottomMenu() |
| | | initClick() |
| | | changeBg() |
| | | } |
| | | |
| | | fun refreshData(){ |
| | |
| | | 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)) |
| | | if (data?.chargeType == 2&&data.isVip != 1){ //会员免费 |
| | | startActivity<VipActivity>() |
| | | }else if (data?.chargeType == 3&&data.isBuy != 1){ //单独收费且未购买 |
| | | startActivity<BuyVoiceActivity>("id" to data.id) |
| | | }else{ |
| | | if (MainActivity.playing) |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.FINISH_THINK)) |
| | | MainActivity.voice = data |
| | | EventBus.getDefault().post(EmptyEvent(Const.EventCode.START_THINK)) |
| | | } |
| | | }){_,_-> |
| | | dismissDialog() |
| | | } |
| | |
| | | iv_pri_empty.setOnClickListener { startActivity<LoginActivity>() } |
| | | } |
| | | |
| | | fun changeBg(){ |
| | | val bg = SPUtils.instance().getString(Const.User.BG) |
| | | fun changeBg(bg:String){ |
| | | if (!bg.isNullOrEmpty()) |
| | | iv_home.setImageURI(bg) |
| | | } |