mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2024-12-28 17:51:35 +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() {
|
||||
MyCameraImpl.newInstance(this).toggleFlashlight()
|
||||
|
||||
qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
|
||||
qsTile.updateTile()
|
||||
updateTile()
|
||||
}
|
||||
|
||||
override fun onTileRemoved() {
|
||||
if (MyCameraImpl.isFlashlightOn)
|
||||
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