mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-04-28 08:58:52 +02:00
make strobo and SOS toggling more reliable
This commit is contained in:
parent
704fa5221d
commit
98f9931cff
@ -25,6 +25,8 @@ class MyCameraImpl(val context: Context) {
|
|||||||
private var params: Camera.Parameters? = null
|
private var params: Camera.Parameters? = null
|
||||||
private var isMarshmallow = false
|
private var isMarshmallow = false
|
||||||
private var shouldEnableFlashlight = false
|
private var shouldEnableFlashlight = false
|
||||||
|
private var shouldEnableStroboscope = false
|
||||||
|
private var shouldEnableSOS = false
|
||||||
private var isStroboSOS = false // are we sending SOS, or casual stroboscope?
|
private var isStroboSOS = false // are we sending SOS, or casual stroboscope?
|
||||||
|
|
||||||
private var marshmallowCamera: MarshmallowCamera? = null
|
private var marshmallowCamera: MarshmallowCamera? = null
|
||||||
@ -55,7 +57,7 @@ class MyCameraImpl(val context: Context) {
|
|||||||
fun toggleStroboscope(): Boolean {
|
fun toggleStroboscope(): Boolean {
|
||||||
if (isSOSRunning) {
|
if (isSOSRunning) {
|
||||||
stopSOS()
|
stopSOS()
|
||||||
toggleStroboscope()
|
shouldEnableStroboscope = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +87,7 @@ class MyCameraImpl(val context: Context) {
|
|||||||
fun toggleSOS(): Boolean {
|
fun toggleSOS(): Boolean {
|
||||||
if (isStroboscopeRunning) {
|
if (isStroboscopeRunning) {
|
||||||
stopStroboscope()
|
stopStroboscope()
|
||||||
toggleSOS()
|
shouldEnableSOS = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,9 +326,19 @@ class MyCameraImpl(val context: Context) {
|
|||||||
isStroboscopeRunning = false
|
isStroboscopeRunning = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldEnableFlashlight) {
|
when {
|
||||||
|
shouldEnableFlashlight -> {
|
||||||
enableFlashlight()
|
enableFlashlight()
|
||||||
shouldEnableFlashlight = false
|
shouldEnableFlashlight = false
|
||||||
}
|
}
|
||||||
|
shouldEnableSOS -> {
|
||||||
|
toggleSOS()
|
||||||
|
shouldEnableSOS = false
|
||||||
|
}
|
||||||
|
shouldEnableStroboscope -> {
|
||||||
|
toggleStroboscope()
|
||||||
|
shouldEnableStroboscope = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user