Skip to content

Commit 93c4cd7

Browse files
committed
fix #19, release camera on flashlight stoping
1 parent 0038b14 commit 93c4cd7

File tree

1 file changed

+5
-0
lines changed
  • app/src/main/kotlin/com/simplemobiletools/flashlight/helpers

1 file changed

+5
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/flashlight/helpers/MyCameraImpl.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ class MyCameraImpl(val context: Context) {
112112
}
113113

114114
private fun checkFlashlight() {
115+
if (camera == null) {
116+
handleCameraSetup()
117+
}
118+
115119
if (isFlashlightOn) {
116120
enableFlashlight()
117121
} else {
@@ -158,6 +162,7 @@ class MyCameraImpl(val context: Context) {
158162
camera!!.parameters = params
159163
}
160164
stateChanged(false)
165+
releaseCamera()
161166
}
162167

163168
private fun stateChanged(isEnabled: Boolean) {

0 commit comments

Comments
 (0)