From e7715838b748d9e02b2d0a2a8266332a429d62e4 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 1 Aug 2021 11:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/service/WebTileService.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/service/WebTileService.kt b/app/src/main/java/io/legado/app/service/WebTileService.kt index a99fb062d..9049db46f 100644 --- a/app/src/main/java/io/legado/app/service/WebTileService.kt +++ b/app/src/main/java/io/legado/app/service/WebTileService.kt @@ -32,15 +32,19 @@ class WebTileService : TileService() { } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { - when (intent?.action) { - IntentAction.start -> { - qsTile.state = Tile.STATE_ACTIVE - qsTile.updateTile() - } - IntentAction.stop -> { - qsTile.state = Tile.STATE_INACTIVE - qsTile.updateTile() + try { + when (intent?.action) { + IntentAction.start -> { + qsTile.state = Tile.STATE_ACTIVE + qsTile.updateTile() + } + IntentAction.stop -> { + qsTile.state = Tile.STATE_INACTIVE + qsTile.updateTile() + } } + } catch (e: Exception) { + e.printStackTrace() } return super.onStartCommand(intent, flags, startId) }