赞
踩
大家都知道一个没有欢迎页的App给人的感觉就像人提了光头一样,很突兀,也很不友好,今天给大家分享一个及其简便的欢迎加载页
interface ICSplash {
interface IPSplash {
fun init()
}
interface IVSplash : BaseView {
fun jumpToMain()
}
}
class SplashPresenter constructor(private val mProvider: LifecycleProvider<ActivityEvent>,
private val mView: ICSplash.IVSplash) : ICSplash.IPSplash {
override fun init() {
Observable.timer(1500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.compose(mProvider.bindToLifecycle())
.subscribe { mView.jumpToMain() }
}
}
class SplashActivity : BaseActivity(), ICSplash.IVSplash { override val layout = R.layout.a_splash override fun initPresenter() { SplashPresenter(this, this).init() } override fun jumpToMain() { //动画加载完成之后需要执行操作,比如跳转Activity } override fun showError(msg: String) { ToastUtils.showShort(msg) } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。