|
|
|
@ -1,10 +1,12 @@ |
|
|
|
|
package io.legado.app.ui.welcome |
|
|
|
|
|
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.graphics.drawable.BitmapDrawable |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import com.github.liuyueyi.quick.transfer.ChineseUtils |
|
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
|
import io.legado.app.constant.Theme |
|
|
|
|
import io.legado.app.data.appDb |
|
|
|
|
import io.legado.app.databinding.ActivityWelcomeBinding |
|
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
@ -13,8 +15,7 @@ import io.legado.app.help.storage.AppWebDav |
|
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
|
import io.legado.app.ui.book.read.ReadBookActivity |
|
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
|
import io.legado.app.utils.* |
|
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
|
import java.util.concurrent.TimeUnit |
|
|
|
|
|
|
|
|
@ -71,11 +72,29 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() { |
|
|
|
|
|
|
|
|
|
override fun upBackgroundImage() { |
|
|
|
|
if (getPrefBoolean(PreferKey.customWelcome)) { |
|
|
|
|
super.upBackgroundImage() |
|
|
|
|
} else { |
|
|
|
|
super.upBackgroundImage() |
|
|
|
|
kotlin.runCatching { |
|
|
|
|
when (Theme.getTheme()) { |
|
|
|
|
Theme.Dark -> getPrefString(PreferKey.welcomeImageDark)?.let { path -> |
|
|
|
|
val size = windowSize |
|
|
|
|
BitmapUtils.decodeBitmap(path, size.widthPixels, size.heightPixels).let { |
|
|
|
|
binding.tvLegado.visible(getPrefBoolean(PreferKey.welcomeShowTextDark)) |
|
|
|
|
window.decorView.background = BitmapDrawable(resources, it) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> getPrefString(PreferKey.welcomeImage)?.let { path -> |
|
|
|
|
val size = windowSize |
|
|
|
|
BitmapUtils.decodeBitmap(path, size.widthPixels, size.heightPixels).let { |
|
|
|
|
binding.tvLegado.visible(getPrefBoolean(PreferKey.welcomeShowText)) |
|
|
|
|
window.decorView.background = BitmapDrawable(resources, it) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
super.upBackgroundImage() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun startMainActivity() { |
|
|
|
|
startActivity<MainActivity>() |
|
|
|
|