pro版本添加自定义启动画面

This commit is contained in:
kunfei
2022-03-06 00:06:22 +08:00
parent 6982ed8cc6
commit 1a81fa646a
3 changed files with 14 additions and 1 deletions
@@ -66,6 +66,7 @@ abstract class BaseActivity<VB : ViewBinding>(
override fun onCreate(savedInstanceState: Bundle?) {
window.decorView.disableAutoFill()
initTheme()
upBackgroundImage()
super.onCreate(savedInstanceState)
setContentView(binding.root)
setupSystemBar()
@@ -121,7 +122,7 @@ abstract class BaseActivity<VB : ViewBinding>(
open fun onCompatOptionsItemSelected(item: MenuItem) = super.onOptionsItemSelected(item)
private fun initTheme() {
open fun initTheme() {
when (theme) {
Theme.Transparent -> setTheme(R.style.AppTheme_Transparent)
Theme.Dark -> {
@@ -141,6 +142,9 @@ abstract class BaseActivity<VB : ViewBinding>(
window.decorView.applyBackgroundTint(backgroundColor)
}
}
}
open fun upBackgroundImage() {
if (imageBg) {
try {
ThemeConfig.getBgImage(this, windowSize)?.let {
@@ -95,6 +95,7 @@ object PreferKey {
const val uploadRule = "uploadRule"
const val tocUiUseReplace = "tocUiUseReplace"
const val enableReadRecord = "enableReadRecord"
const val customWelcome = "customWelcome"
const val welcomeImage = "welcomeImagePath"
const val welcomeImageDark = "welcomeImagePathDark"
const val welcomeShowText = "welcomeShowText"
@@ -69,6 +69,14 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
binding.root.postDelayed({ startMainActivity() }, 500)
}
override fun upBackgroundImage() {
if (getPrefBoolean(PreferKey.customWelcome)) {
super.upBackgroundImage()
} else {
super.upBackgroundImage()
}
}
private fun startMainActivity() {
startActivity<MainActivity>()
if (getPrefBoolean(PreferKey.defaultToRead)) {