From 039d1f8431dd9b1b90e5af5fe18367d0291c2bf3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 8 Dec 2017 17:13:52 +0100 Subject: [PATCH] use helper extension functions for checking if the activity is alive --- .../com/simplemobiletools/camera/activities/MainActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 8f9803a5..1111e25d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/MainActivity.kt @@ -401,7 +401,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave mPreviewUri = Uri.withAppendedPath(uri, lastMediaId.toString()) runOnUiThread { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) { + if (!isActivityDestroyed()) { val options = RequestOptions() .centerCrop() .diskCacheStrategy(DiskCacheStrategy.NONE) @@ -488,7 +488,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave private fun setupOrientationEventListener() { mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { override fun onOrientationChanged(orientation: Int) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) { + if (isActivityDestroyed()) { mOrientationEventListener.disable() return }