From 8d9eb42b06e2fb77f74b73bbf06d699f5bb25f39 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 8 May 2021 16:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 1 + .../main/java/io/legado/app/base/BaseActivity.kt | 13 +++++++++---- .../main/java/io/legado/app/base/VMBaseActivity.kt | 6 ++++-- .../legado/app/ui/book/read/ReadBookBaseActivity.kt | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 8095cacd6..5072d7149 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -7,6 +7,7 @@ * 预下载章节可调整数目 * 修复低版本Android使用TTS闪退。 by ag2s20150909 * 修复WebDav报错 +* 优化翻页动画点击翻页 **2021/05/06** * 修复bug diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index 4d2707444..8319d077b 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -33,7 +33,8 @@ abstract class BaseActivity( val fullScreen: Boolean = true, private val theme: Theme = Theme.Auto, private val toolBarTheme: Theme = Theme.Auto, - private val transparent: Boolean = false + private val transparent: Boolean = false, + private val imageBg: Boolean = true ) : AppCompatActivity(), CoroutineScope by MainScope() { @@ -173,9 +174,13 @@ abstract class BaseActivity( ATH.applyBackgroundTint(window.decorView) } } - ThemeConfig.getBgImage(this)?.let { - kotlin.runCatching { - window.decorView.background = it + if (imageBg) { + ThemeConfig.getBgImage(this)?.let { + try { + window.decorView.background = it + } catch (e: OutOfMemoryError) { + toastOnUi("Image Bg Out Of Memory") + } } } } diff --git a/app/src/main/java/io/legado/app/base/VMBaseActivity.kt b/app/src/main/java/io/legado/app/base/VMBaseActivity.kt index d86ba3699..3eeb5c91b 100644 --- a/app/src/main/java/io/legado/app/base/VMBaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/VMBaseActivity.kt @@ -7,8 +7,10 @@ import io.legado.app.constant.Theme abstract class VMBaseActivity( fullScreen: Boolean = true, theme: Theme = Theme.Auto, - toolBarTheme: Theme = Theme.Auto -) : BaseActivity(fullScreen, theme, toolBarTheme) { + toolBarTheme: Theme = Theme.Auto, + transparent: Boolean = false, + imageBg: Boolean = true +) : BaseActivity(fullScreen, theme, toolBarTheme, transparent, imageBg) { protected abstract val viewModel: VM diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 843995702..e2d10bf9b 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -39,7 +39,7 @@ import io.legado.app.utils.requestInputMethod * 阅读界面 */ abstract class ReadBookBaseActivity : - VMBaseActivity() { + VMBaseActivity(imageBg = false) { override val viewModel: ReadBookViewModel by viewModels()