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

pull/1689/head
kunfei 3 years ago
parent 6982ed8cc6
commit 1a81fa646a
  1. 6
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 8
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt

@ -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)) {

Loading…
Cancel
Save