mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-01-22 19:40:12 +01:00
move the permission checking things into a separate function
This commit is contained in:
parent
e44e1ccdbf
commit
8c0e0af270
@ -513,6 +513,24 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||
mRecorder!!.setProfile(this)
|
||||
}
|
||||
|
||||
checkPermissions()
|
||||
mRecorder!!.setPreviewDisplay(mSurfaceHolder.surface)
|
||||
|
||||
val rotation = getVideoRotation()
|
||||
mInitVideoRotation = rotation
|
||||
mRecorder!!.setOrientationHint(90)
|
||||
|
||||
try {
|
||||
mRecorder!!.prepare()
|
||||
} catch (e: Exception) {
|
||||
setupFailed(e)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private fun checkPermissions(): Boolean {
|
||||
if (mActivity.needsStupidWritePermissions(mCurrVideoPath)) {
|
||||
if (config.treeUri.isEmpty()) {
|
||||
mActivity.toast(R.string.save_error_internal_storage)
|
||||
@ -537,19 +555,6 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
||||
} else {
|
||||
mRecorder!!.setOutputFile(mCurrVideoPath)
|
||||
}
|
||||
mRecorder!!.setPreviewDisplay(mSurfaceHolder.surface)
|
||||
|
||||
val rotation = getVideoRotation()
|
||||
mInitVideoRotation = rotation
|
||||
mRecorder!!.setOrientationHint(rotation)
|
||||
|
||||
try {
|
||||
mRecorder!!.prepare()
|
||||
} catch (e: Exception) {
|
||||
setupFailed(e)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user