mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2024-12-29 02:05:16 +01:00
Update State of Tile
- State is now „synced“ when the tile is added or the quicksettings are expanded refs #41
This commit is contained in:
parent
0b665c8b8f
commit
2d5c6d222b
@ -10,13 +10,24 @@ class MyTileService : TileService() {
|
|||||||
|
|
||||||
override fun onClick() {
|
override fun onClick() {
|
||||||
MyCameraImpl.newInstance(this).toggleFlashlight()
|
MyCameraImpl.newInstance(this).toggleFlashlight()
|
||||||
|
updateTile()
|
||||||
qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
|
|
||||||
qsTile.updateTile()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTileRemoved() {
|
override fun onTileRemoved() {
|
||||||
if (MyCameraImpl.isFlashlightOn)
|
if (MyCameraImpl.isFlashlightOn)
|
||||||
MyCameraImpl.newInstance(this).toggleFlashlight()
|
MyCameraImpl.newInstance(this).toggleFlashlight()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
override fun onStartListening() {
|
||||||
|
updateTile()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTileAdded() {
|
||||||
|
updateTile()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateTile() {
|
||||||
|
qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
|
||||||
|
qsTile.updateTile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user