From 0d5fd22921a73735ba3b76ec89fc9d3cbc62d897 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 22 Jun 2017 22:04:52 +0200 Subject: [PATCH] start checking device orientation only after permissions were granted --- .../camera/activities/MainActivity.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 683c519c..b59bcafd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -469,7 +469,9 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave toggleBottomButtons(false) } window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - mOrientationEventListener.enable() + if (hasCameraAndStoragePermission()) { + mOrientationEventListener.enable() + } } private fun resumeCameraItems() { @@ -541,11 +543,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave private fun animateViews(degrees: Int) { val views = arrayOf(toggle_camera, toggle_flash, toggle_photo_video, change_resolution, shutter, settings, last_photo_video_preview) for (view in views) { - try { - rotate(view, degrees) - } catch (ignored: IllegalStateException) { - - } + rotate(view, degrees) } }