mirror of
				https://github.com/SimpleMobileTools/Simple-Flashlight.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	Turn off flashlight when tile is removed
This commit is contained in:
		| @@ -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() | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user