Properly reflect flash state in main screen icons

This commit is contained in:
Ensar Sarajčić
2023-10-02 12:59:57 +02:00
parent 3414295887
commit 81096e35a6
2 changed files with 4 additions and 15 deletions

View File

@ -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() {