pull/433/head 3.20.101908
gedoor 4 years ago
parent 3683fd26b3
commit 0c07b6fe42
  1. 16
      app/src/main/java/io/legado/app/receiver/TimeBatteryReceiver.kt

@ -25,15 +25,13 @@ class TimeBatteryReceiver : BroadcastReceiver() {
} }
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
intent?.action?.let { when (intent?.action) {
when (it) { Intent.ACTION_TIME_TICK -> {
Intent.ACTION_TIME_TICK -> { postEvent(EventBus.TIME_CHANGED, "")
postEvent(EventBus.TIME_CHANGED, "") }
} Intent.ACTION_BATTERY_CHANGED -> {
Intent.ACTION_BATTERY_CHANGED -> { val level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1)
val level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) postEvent(EventBus.BATTERY_CHANGED, level)
postEvent(EventBus.BATTERY_CHANGED, level)
}
} }
} }
} }

Loading…
Cancel
Save