reinit the static variables at app launch

This commit is contained in:
tibbi 2017-05-07 15:39:15 +02:00
parent e721f43274
commit e56e1f15d1
1 changed files with 14 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
requestWindowFeature(Window.FEATURE_NO_TITLE) requestWindowFeature(Window.FEATURE_NO_TITLE)
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
mRes = resources initVariables()
tryInitCamera() tryInitCamera()
supportActionBar?.hide() supportActionBar?.hide()
storeStoragePaths() storeStoragePaths()
@ -68,6 +68,19 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
setupOrientationEventListener() setupOrientationEventListener()
} }
private fun initVariables() {
mRes = resources
mIsInPhotoMode = false
mIsAskingPermissions = false
mIsCameraAvailable = false
mIsImageCaptureIntent = false
mIsVideoCaptureIntent = false
mIsHardwareShutterHandled = false
mCurrVideoRecTimer = 0
mCurrCameraId = 0
mLastHandledOrientation = 0
}
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
return if (keyCode == KeyEvent.KEYCODE_CAMERA && !mIsHardwareShutterHandled) { return if (keyCode == KeyEvent.KEYCODE_CAMERA && !mIsHardwareShutterHandled) {
mIsHardwareShutterHandled = true mIsHardwareShutterHandled = true