From 486fa06223c9cfb8d6702dd167ac108d133370c3 Mon Sep 17 00:00:00 2001 From: Niko Diamadis Date: Mon, 12 Feb 2024 16:15:17 +0100 Subject: [PATCH] fix: Repair buggy settings tile --- .../kotlin/com/cyb3rko/flashdim/tiles/DimmerSettingsTile.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/kotlin/com/cyb3rko/flashdim/tiles/DimmerSettingsTile.kt b/app/src/main/kotlin/com/cyb3rko/flashdim/tiles/DimmerSettingsTile.kt index 4029324..abcd065 100644 --- a/app/src/main/kotlin/com/cyb3rko/flashdim/tiles/DimmerSettingsTile.kt +++ b/app/src/main/kotlin/com/cyb3rko/flashdim/tiles/DimmerSettingsTile.kt @@ -27,10 +27,13 @@ import com.cyb3rko.flashdim.handleFlashlightException import com.cyb3rko.flashdim.utils.Safe class DimmerSettingsTile : TileService() { + private var description = "" + override fun onClick() { if (qsTile.state == Tile.STATE_UNAVAILABLE) return Safe.initialize(applicationContext) val mode = Safe.getInt(Safe.QUICKTILE_DIM_MODE, DIMMER_MIN) + description = mode.description() val maxLevel = Safe.getInt(Safe.MAX_LEVEL, -1) val newLevel = when (mode) { @@ -67,6 +70,7 @@ class DimmerSettingsTile : TileService() { object : CameraManager.TorchCallback() { override fun onTorchModeChanged(cameraId: String, enabled: Boolean) { if (qsTile == null) return + if (description.isNotEmpty()) qsTile.subtitle = "State: $description" qsTile.state = if (enabled) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE qsTile.updateTile() }