Skip to content

Commit

Permalink
Update flash_python_file.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NILEG authored Jul 29, 2023
1 parent b25631e commit 2406fd9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions flash_python_file.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from jnius import autoclass, cast

class Flash:
CameraManager = autoclass('android.hardware.camera2.CameraManager')
Context=autoclass("android.content.Context")
context=Context()
camera_manager=cast("android.hardware.camera2.CameraManager",context.getSystemService(Context.CAMERA_SERVICE))
cameraid = camera_manager.getCameraIdList()[0]
@staticmethod
def initialize():
CameraManager = autoclass('android.hardware.camera2.CameraManager')
Context=autoclass("android.content.Context")
context=Context()
self.camera_manager=cast("android.hardware.camera2.CameraManager",context.getSystemService(Context.CAMERA_SERVICE))
cameraid = self.camera_manager.getCameraIdList()[0]
@staticmethod
def on():
Flash.camera_manager.setTorchMode(Flash.cameraid, True)
self.camera_manager.setTorchMode(Flash.cameraid, True)
@staticmethod
def off():
Flash.camera_manager.setTorchMode(Flash.cameraid, False)
self.camera_manager.setTorchMode(Flash.cameraid, False)

0 comments on commit 2406fd9

Please sign in to comment.