feat: 优化代码

pull/141/head
kunfei 5 years ago
parent 10a338609d
commit ae5823abe3
  1. 6
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  2. 4
      app/src/main/java/io/legado/app/utils/EventBusKt.kt

@ -169,8 +169,10 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar
private fun upTheme(isNightTheme: Boolean) {
if (AppConfig.isNightTheme == isNightTheme) {
App.INSTANCE.applyTheme()
recreateActivities()
listView.post {
App.INSTANCE.applyTheme()
recreateActivities()
}
}
}

@ -14,6 +14,10 @@ inline fun <reified EVENT> postEvent(tag: String, event: EVENT) {
LiveEventBus.get(tag).post(event)
}
inline fun <reified EVENT> postEventDelay(tag: String, event: EVENT, delay: Long) {
LiveEventBus.get(tag).postDelay(event, delay)
}
inline fun <reified EVENT> AppCompatActivity.observeEvent(
vararg tags: String,
noinline observer: (EVENT) -> Unit

Loading…
Cancel
Save