mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-03-03 19:20:04 +01:00
show an error at marshmallow flashlight toggling too
This commit is contained in:
parent
dc91665ba7
commit
b19d02fd34
@ -5,6 +5,7 @@ import android.content.Context
|
|||||||
import android.hardware.camera2.CameraManager
|
import android.hardware.camera2.CameraManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||||
import com.simplemobiletools.flashlight.models.Events
|
import com.simplemobiletools.flashlight.models.Events
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ internal class MarshmallowCamera constructor(val context: Context) {
|
|||||||
try {
|
try {
|
||||||
manager.setTorchMode(cameraId!!, enable)
|
manager.setTorchMode(cameraId!!, enable)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
context.showErrorToast(e)
|
||||||
val mainRunnable = Runnable {
|
val mainRunnable = Runnable {
|
||||||
EventBus.getDefault().post(Events.CameraUnavailable())
|
EventBus.getDefault().post(Events.CameraUnavailable())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user