From 0c07b6fe424b959ec93ea50d704d39ea763de31e Mon Sep 17 00:00:00 2001 From: gedoor Date: Mon, 19 Oct 2020 09:16:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/receiver/TimeBatteryReceiver.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/receiver/TimeBatteryReceiver.kt b/app/src/main/java/io/legado/app/receiver/TimeBatteryReceiver.kt index ce2e04fbe..73737aa79 100644 --- a/app/src/main/java/io/legado/app/receiver/TimeBatteryReceiver.kt +++ b/app/src/main/java/io/legado/app/receiver/TimeBatteryReceiver.kt @@ -25,15 +25,13 @@ class TimeBatteryReceiver : BroadcastReceiver() { } override fun onReceive(context: Context?, intent: Intent?) { - intent?.action?.let { - when (it) { - Intent.ACTION_TIME_TICK -> { - postEvent(EventBus.TIME_CHANGED, "") - } - Intent.ACTION_BATTERY_CHANGED -> { - val level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) - postEvent(EventBus.BATTERY_CHANGED, level) - } + when (intent?.action) { + Intent.ACTION_TIME_TICK -> { + postEvent(EventBus.TIME_CHANGED, "") + } + Intent.ACTION_BATTERY_CHANGED -> { + val level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) + postEvent(EventBus.BATTERY_CHANGED, level) } } }