Turn off flashlight when tile is removed
This commit is contained in:
parent
a304f4fc02
commit
0b665c8b8f
|
@ -7,10 +7,16 @@ import android.support.annotation.RequiresApi
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
class MyTileService : TileService() {
|
class MyTileService : TileService() {
|
||||||
|
|
||||||
override fun onClick() {
|
override fun onClick() {
|
||||||
MyCameraImpl.newInstance(this).toggleFlashlight()
|
MyCameraImpl.newInstance(this).toggleFlashlight()
|
||||||
|
|
||||||
qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
|
qsTile.state = if (MyCameraImpl.isFlashlightOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
|
||||||
qsTile.updateTile()
|
qsTile.updateTile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onTileRemoved() {
|
||||||
|
if (MyCameraImpl.isFlashlightOn)
|
||||||
|
MyCameraImpl.newInstance(this).toggleFlashlight()
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue