添加闪屏页相关逻辑,界面待实现

This commit is contained in:
tongchenfei
2020-07-16 17:22:53 +08:00
parent efcc63b3fa
commit 1c0b58fb3d
5 changed files with 53 additions and 7 deletions

View File

@@ -300,7 +300,7 @@ dependencies {
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
implementation project(':modules:mogo-module-media')
implementation project(':modules:mogo-module-service')
// implementation project(':modules:mogo-module-splash')
implementation project(':modules:mogo-module-splash')
// 事件面板分渠道引用
d82xImplementation project(':modules:mogo-module-event-panel-noop')
em1Implementation project(':modules:mogo-module-event-panel-noop')

View File

@@ -1,6 +1,6 @@
package com.zhidao.mogo.module.splash
object BydConst {
object SplashConst {
const val MODULE_NAME = "MODULE_SPLASH"
const val PATH_NAME = "/splash/api"
}

View File

@@ -13,8 +13,8 @@ import com.mogo.map.navi.IMogoNaviListener
import com.mogo.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.splash.BydConst.MODULE_NAME
import com.zhidao.mogo.module.splash.BydConst.PATH_NAME
import com.zhidao.mogo.module.splash.SplashConst.MODULE_NAME
import com.zhidao.mogo.module.splash.SplashConst.PATH_NAME
import com.zhidao.mogo.module.splash.fragment.BydSplashFragment
/**
@@ -23,7 +23,7 @@ import com.zhidao.mogo.module.splash.fragment.BydSplashFragment
* @author tongchenfei
*/
@Route(path = PATH_NAME)
class BydProvider : IMogoModuleProvider {
class SplashProvider : IMogoModuleProvider {
override fun getNaviListener(): IMogoNaviListener? {
return null
}

View File

@@ -1,19 +1,53 @@
package com.zhidao.mogo.module.splash.fragment
import android.os.Handler
import android.os.Message
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.splash.R
import com.zhidao.mogo.module.splash.presenter.BydSplashPresenter
import kotlinx.android.synthetic.main.fragment_byd_splash.*
class BydSplashFragment :MvpFragment<BydSplashFragment,BydSplashPresenter>(){
const val DEFAULT_COUNT_DOWN_TIME = 5
const val MSG_COUNT_DOWN = 1001
const val DEFAULT_COUNT_DOWN_DELAY = 1000L
class BydSplashFragment :MvpFragment<BydSplashFragment,BydSplashPresenter>(),Handler.Callback{
private val handler = Handler(this)
private var countDownTime = DEFAULT_COUNT_DOWN_TIME
override fun getLayoutId(): Int = R.layout.fragment_byd_splash
override fun initViews() {
startCountDown()
tvByd.setOnClickListener {
activity!!.supportFragmentManager.beginTransaction().remove(this).commit()
hideSplash()
}
}
override fun createPresenter(): BydSplashPresenter = BydSplashPresenter(this)
private fun startCountDown(){
handler.removeMessages(MSG_COUNT_DOWN)
countDownTime = DEFAULT_COUNT_DOWN_TIME
tvCountDown.text = countDownTime.toString()
handler.sendEmptyMessageDelayed(MSG_COUNT_DOWN, DEFAULT_COUNT_DOWN_DELAY)
}
override fun handleMessage(msg: Message): Boolean {
if (msg.what == MSG_COUNT_DOWN) {
countDownTime--
if(countDownTime>0) {
tvCountDown.text = countDownTime.toString()
handler.sendEmptyMessageDelayed(MSG_COUNT_DOWN, DEFAULT_COUNT_DOWN_DELAY)
}else{
hideSplash()
}
return true
}
return false
}
private fun hideSplash(){
handler.removeMessages(MSG_COUNT_DOWN)
activity!!.supportFragmentManager.beginTransaction().remove(this).commit()
}
}

View File

@@ -20,4 +20,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCountDown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="5"
android:textColor="#000"
android:textSize="30sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>