adding some crashfixes
This commit is contained in:
parent
128f01c751
commit
e28525f23c
|
@ -62,7 +62,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:af11ea2e30'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:f538687d6e'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
}
|
||||
|
|
|
@ -10,9 +10,14 @@ class LollipopCameraFlash : CameraFlash {
|
|||
private var params: Camera.Parameters? = null
|
||||
|
||||
override fun toggleFlashlight(enable: Boolean) {
|
||||
if (camera == null || params == null || camera!!.parameters == null) {
|
||||
try {
|
||||
if (camera == null || params == null || camera!!.parameters == null) {
|
||||
return
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
return
|
||||
}
|
||||
|
||||
val flashMode = if (enable) Camera.Parameters.FLASH_MODE_ON else Camera.Parameters.FLASH_MODE_OFF
|
||||
params!!.flashMode = flashMode
|
||||
camera!!.parameters = params
|
||||
|
@ -31,7 +36,7 @@ class LollipopCameraFlash : CameraFlash {
|
|||
}
|
||||
|
||||
override fun release() {
|
||||
camera!!.release()
|
||||
camera?.release()
|
||||
camera = null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue