From 34f706ecda0974a00625db5598fee84fb4d324cf Mon Sep 17 00:00:00 2001 From: Horis <8674809+821938089@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:31:12 +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 --- .../io/legado/app/help/update/AppReleaseInfo.kt | 2 +- .../java/io/legado/app/service/WebTileService.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/update/AppReleaseInfo.kt b/app/src/main/java/io/legado/app/help/update/AppReleaseInfo.kt index acf0d3b4e..c3e5e0e36 100644 --- a/app/src/main/java/io/legado/app/help/update/AppReleaseInfo.kt +++ b/app/src/main/java/io/legado/app/help/update/AppReleaseInfo.kt @@ -13,7 +13,7 @@ data class AppReleaseInfo( val downloadUrl: String, val assetUrl: String ) { - val versionName: String = name.split("_").getOrNull(2)?.removeSuffix(".apk") ?: "" + val versionName: String = name.split("_").getOrNull(2)?.dropLast(2) ?: "" } enum class AppVariant { 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 3ab5e705d..68bd72c5d 100644 --- a/app/src/main/java/io/legado/app/service/WebTileService.kt +++ b/app/src/main/java/io/legado/app/service/WebTileService.kt @@ -40,12 +40,13 @@ class WebTileService : TileService() { override fun onStartListening() { super.onStartListening() - if (WebService.isRun) { - qsTile.state = Tile.STATE_ACTIVE - qsTile.updateTile() - } else { - qsTile.state = Tile.STATE_INACTIVE - qsTile.updateTile() + qsTile?.run { + state = if (WebService.isRun) { + Tile.STATE_ACTIVE + } else { + Tile.STATE_INACTIVE + } + updateTile() } }