fix 自动刷新

pull/2002/head
821938089 2 years ago
parent 0ab76a176f
commit e65e2259f9
  1. 10
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -88,7 +88,8 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
upVersion()
privacyPolicy()
//自动更新书籍
if (AppConfig.autoRefreshBook) {
val isAutoRefreshedBook = savedInstanceState?.getBoolean("isAutoRefreshedBook") ?: false
if (AppConfig.autoRefreshBook && !isAutoRefreshedBook) {
binding.viewPagerMain.postDelayed(1000) {
viewModel.upAllBookToc()
}
@ -210,6 +211,13 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
return super.onKeyUp(keyCode, event)
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
if (AppConfig.autoRefreshBook) {
outState.putBoolean("isAutoRefreshedBook", true)
}
}
override fun onDestroy() {
super.onDestroy()
Coroutine.async {

Loading…
Cancel
Save