Skip to content

Commit c975ab1

Browse files
committed
clear listeners after disabling flash for SOS and stroboscope
- this prevents the two sliders for brightness and stroboscope from showing up at the same time
1 parent 98c0f05 commit c975ab1

File tree

1 file changed

+4
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/flashlight/helpers

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
4949

5050
fun toggleStroboscope(): Boolean {
5151
handleCameraSetup()
52-
cameraFlash!!.unregisterListeners()
5352

5453
if (isSOSRunning) {
5554
stopSOS()
@@ -62,6 +61,8 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
6261
disableFlashlight()
6362
}
6463

64+
cameraFlash!!.unregisterListeners()
65+
6566
if (!tryInitCamera()) {
6667
return false
6768
}
@@ -82,7 +83,6 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
8283

8384
fun toggleSOS(): Boolean {
8485
handleCameraSetup()
85-
cameraFlash!!.unregisterListeners()
8686

8787
if (isStroboscopeRunning) {
8888
stopStroboscope()
@@ -103,6 +103,8 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
103103
disableFlashlight()
104104
}
105105

106+
cameraFlash!!.unregisterListeners()
107+
106108
return if (isSOSRunning) {
107109
stopSOS()
108110
false

0 commit comments

Comments
 (0)