small cleanup at checking camera availability
This commit is contained in:
parent
05dee60cb7
commit
86d13eaf54
|
@ -199,8 +199,10 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||
mIsInPhotoMode = true
|
||||
mTimerHandler = Handler()
|
||||
mFadeHandler = Handler()
|
||||
mPreview!!.setFlashlightState(if (config.turnFlashOffAtStartup) FLASH_OFF else config.flashlightState)
|
||||
setupPreviewImage(true)
|
||||
|
||||
val initialFlashlightState = if (config.turnFlashOffAtStartup) FLASH_OFF else config.flashlightState
|
||||
mPreview!!.setFlashlightState(initialFlashlightState)
|
||||
}
|
||||
|
||||
private fun initButtons() {
|
||||
|
@ -214,12 +216,10 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||
}
|
||||
|
||||
private fun toggleCamera() {
|
||||
if (!checkCameraAvailable()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (checkCameraAvailable()) {
|
||||
mPreview!!.toggleCamera()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLastMediaPreview() {
|
||||
if (mPreviewUri != null) {
|
||||
|
@ -229,12 +229,10 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||
}
|
||||
|
||||
private fun toggleFlash() {
|
||||
if (!checkCameraAvailable()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (checkCameraAvailable()) {
|
||||
mPreview?.toggleFlashlight()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateFlashlightState(state: Int) {
|
||||
config.flashlightState = state
|
||||
|
@ -311,8 +309,9 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||
return
|
||||
}
|
||||
|
||||
if (mIsVideoCaptureIntent)
|
||||
if (mIsVideoCaptureIntent) {
|
||||
mPreview?.trySwitchToVideo()
|
||||
}
|
||||
|
||||
mPreview?.setFlashlightState(FLASH_OFF)
|
||||
hideTimer()
|
||||
|
|
Loading…
Reference in New Issue