mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-16 20:00:40 +01:00
Properly reflect flash state in main screen icons
This commit is contained in:
parent
3414295887
commit
81096e35a6
@ -394,20 +394,7 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun checkState(isEnabled: Boolean) {
|
||||
if (isEnabled) {
|
||||
enableFlashlight()
|
||||
} else {
|
||||
disableFlashlight()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun enableFlashlight() {
|
||||
_flashlightOn.value = true
|
||||
}
|
||||
|
||||
private fun disableFlashlight() {
|
||||
_flashlightOn.value = false
|
||||
_flashlightOn.value = isEnabled
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -428,7 +415,7 @@ class MainActivity : SimpleActivity() {
|
||||
@Subscribe
|
||||
fun cameraUnavailable(event: Events.CameraUnavailable) {
|
||||
getApplication<Application>().toast(R.string.camera_error)
|
||||
disableFlashlight()
|
||||
_flashlightOn.value = false
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
@ -276,8 +276,10 @@ class MyCameraImpl private constructor(val context: Context, private var cameraT
|
||||
shouldStroboscopeStop = false
|
||||
if (isStroboSOS) {
|
||||
isSOSRunning = false
|
||||
EventBus.getDefault().post(Events.StopSOS())
|
||||
} else {
|
||||
isStroboscopeRunning = false
|
||||
EventBus.getDefault().post(Events.StopStroboscope())
|
||||
}
|
||||
|
||||
when {
|
||||
|
Loading…
x
Reference in New Issue
Block a user