|
|
@ -1,10 +1,12 @@ |
|
|
|
package io.legado.app.ui.welcome |
|
|
|
package io.legado.app.ui.welcome |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Intent |
|
|
|
import android.content.Intent |
|
|
|
|
|
|
|
import android.graphics.drawable.BitmapDrawable |
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
import com.github.liuyueyi.quick.transfer.ChineseUtils |
|
|
|
import com.github.liuyueyi.quick.transfer.ChineseUtils |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
import io.legado.app.base.BaseActivity |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
|
|
|
|
import io.legado.app.constant.Theme |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.databinding.ActivityWelcomeBinding |
|
|
|
import io.legado.app.databinding.ActivityWelcomeBinding |
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
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.lib.theme.accentColor |
|
|
|
import io.legado.app.ui.book.read.ReadBookActivity |
|
|
|
import io.legado.app.ui.book.read.ReadBookActivity |
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
import io.legado.app.utils.getPrefBoolean |
|
|
|
import io.legado.app.utils.* |
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
|
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import java.util.concurrent.TimeUnit |
|
|
|
import java.util.concurrent.TimeUnit |
|
|
|
|
|
|
|
|
|
|
@ -41,7 +42,7 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() { |
|
|
|
AppWebDav.getBookProgress(book)?.let { bookProgress -> |
|
|
|
AppWebDav.getBookProgress(book)?.let { bookProgress -> |
|
|
|
if (bookProgress.durChapterIndex > book.durChapterIndex || |
|
|
|
if (bookProgress.durChapterIndex > book.durChapterIndex || |
|
|
|
(bookProgress.durChapterIndex == book.durChapterIndex && |
|
|
|
(bookProgress.durChapterIndex == book.durChapterIndex && |
|
|
|
bookProgress.durChapterPos > book.durChapterPos) |
|
|
|
bookProgress.durChapterPos > book.durChapterPos) |
|
|
|
) { |
|
|
|
) { |
|
|
|
book.durChapterIndex = bookProgress.durChapterIndex |
|
|
|
book.durChapterIndex = bookProgress.durChapterIndex |
|
|
|
book.durChapterPos = bookProgress.durChapterPos |
|
|
|
book.durChapterPos = bookProgress.durChapterPos |
|
|
@ -71,10 +72,28 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() { |
|
|
|
|
|
|
|
|
|
|
|
override fun upBackgroundImage() { |
|
|
|
override fun upBackgroundImage() { |
|
|
|
if (getPrefBoolean(PreferKey.customWelcome)) { |
|
|
|
if (getPrefBoolean(PreferKey.customWelcome)) { |
|
|
|
super.upBackgroundImage() |
|
|
|
kotlin.runCatching { |
|
|
|
} else { |
|
|
|
when (Theme.getTheme()) { |
|
|
|
super.upBackgroundImage() |
|
|
|
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() { |
|
|
|
private fun startMainActivity() { |
|
|
|