pull/60/head
kunfei 5 years ago
parent 9620189b24
commit f1bca15552
  1. 17
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  2. 7
      app/src/main/java/io/legado/app/base/VMBaseActivity.kt
  3. 3
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  4. 2
      app/src/main/res/values/styles.xml

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

@ -2,8 +2,11 @@ package io.legado.app.base
import androidx.lifecycle.ViewModel
abstract class VMBaseActivity<VM : ViewModel>(layoutID: Int, fullScreen: Boolean = true) :
BaseActivity(layoutID, fullScreen) {
abstract class VMBaseActivity<VM : ViewModel>(
layoutID: Int,
fullScreen: Boolean = true,
initTheme: Boolean = true
) : BaseActivity(layoutID, fullScreen, initTheme) {
protected abstract val viewModel: VM

@ -36,7 +36,8 @@ import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
class BookInfoActivity : VMBaseActivity<BookInfoViewModel>(R.layout.activity_book_info),
class BookInfoActivity :
VMBaseActivity<BookInfoViewModel>(R.layout.activity_book_info, initTheme = false),
GroupSelectDialog.CallBack,
ChapterListAdapter.CallBack,
ChangeSourceDialog.CallBack {

@ -25,7 +25,7 @@
<!-- BookInfo主题 -->
<style name="AppTheme.BookInfo" parent="Base.AppTheme">
<item name="actionBarStyle">@style/AppTheme.AppBarOverlay.Light</item>
<item name="actionBarStyle">@style/AppTheme.AppBarOverlay.Dark</item>
<item name="elevation">0dp</item><!--去掉toolbar阴影,去线留白-->
</style>

Loading…
Cancel
Save