From f1bca155529fecef5f0969983619a44045937dab Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Dec 2019 21:28:01 +0800 Subject: [PATCH] up --- .../java/io/legado/app/base/BaseActivity.kt | 17 +++++++++++------ .../java/io/legado/app/base/VMBaseActivity.kt | 7 +++++-- .../legado/app/ui/book/info/BookInfoActivity.kt | 3 ++- app/src/main/res/values/styles.xml | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) 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 c30e61a9c..3c645407a 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -19,8 +19,11 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel -abstract class BaseActivity(private val layoutID: Int, private val fullScreen: Boolean = true) : - AppCompatActivity(), +abstract class BaseActivity( + private val layoutID: Int, + private val fullScreen: Boolean = true, + private val initTheme: Boolean = true +) : AppCompatActivity(), CoroutineScope by MainScope() { override fun onCreate(savedInstanceState: Bundle?) { @@ -73,10 +76,12 @@ abstract class BaseActivity(private val layoutID: Int, private val fullScreen: B private fun initTheme() { ATH.applyBackgroundTint(window.decorView) - if (ColorUtils.isColorLight(primaryColor)) { - setTheme(R.style.AppTheme_Light) - } else { - setTheme(R.style.AppTheme_Dark) + if (initTheme) { + if (ColorUtils.isColorLight(primaryColor)) { + setTheme(R.style.AppTheme_Light) + } else { + setTheme(R.style.AppTheme_Dark) + } } } 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 8267a2c8b..e52067060 100644 --- a/app/src/main/java/io/legado/app/base/VMBaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/VMBaseActivity.kt @@ -2,8 +2,11 @@ package io.legado.app.base import androidx.lifecycle.ViewModel -abstract class VMBaseActivity(layoutID: Int, fullScreen: Boolean = true) : - BaseActivity(layoutID, fullScreen) { +abstract class VMBaseActivity( + layoutID: Int, + fullScreen: Boolean = true, + initTheme: Boolean = true +) : BaseActivity(layoutID, fullScreen, initTheme) { protected abstract val viewModel: VM diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 2c1c28a79..ec3b3060a 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -36,7 +36,8 @@ import org.jetbrains.anko.startActivity import org.jetbrains.anko.toast -class BookInfoActivity : VMBaseActivity(R.layout.activity_book_info), +class BookInfoActivity : + VMBaseActivity(R.layout.activity_book_info, initTheme = false), GroupSelectDialog.CallBack, ChapterListAdapter.CallBack, ChangeSourceDialog.CallBack { diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5e9157a35..61054e519 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -25,7 +25,7 @@