From e56e1f15d1d5af5c783f00c5ade113584de66695 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 7 May 2017 15:39:15 +0200 Subject: [PATCH] reinit the static variables at app launch --- .../camera/activities/MainActivity.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt index 8eb48732..b06abdb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -60,7 +60,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave super.onCreate(savedInstanceState) requestWindowFeature(Window.FEATURE_NO_TITLE) window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) - mRes = resources + initVariables() tryInitCamera() supportActionBar?.hide() storeStoragePaths() @@ -68,6 +68,19 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave 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 { return if (keyCode == KeyEvent.KEYCODE_CAMERA && !mIsHardwareShutterHandled) { mIsHardwareShutterHandled = true