diff --git a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyTileService.kt b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyTileService.kt index 35c24c6..0516804 100644 --- a/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyTileService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyTileService.kt @@ -7,10 +7,16 @@ import android.support.annotation.RequiresApi @RequiresApi(Build.VERSION_CODES.N) class MyTileService : TileService() { + override fun onClick() { MyCameraImpl.newInstance(this).toggleFlashlight() qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE qsTile.updateTile() } + + override fun onTileRemoved() { + if (MyCameraImpl.isFlashlightOn) + MyCameraImpl.newInstance(this).toggleFlashlight() + } } \ No newline at end of file