From 0d6c9589e3b9570ae09fa687bc9a3cf0e5082545 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Feb 2019 21:40:33 +0100 Subject: [PATCH] fixing some manual rotation related glitch --- .../gallery/pro/activities/ViewPagerActivity.kt | 3 ++- .../simplemobiletools/gallery/pro/fragments/PhotoFragment.kt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index ac06ffe53..4fe3f6e03 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -141,7 +141,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View currentMedium.isFavorite = mFavoritePaths.contains(currentMedium.path) val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0 - val rotationDegrees = getCurrentPhotoFragment()?.mCurrentRotationDegrees + val rotationDegrees = getCurrentPhotoFragment()?.mCurrentRotationDegrees ?: 1 menu.apply { findItem(R.id.menu_show_on_map).isVisible = visibleBottomActions and BOTTOM_ACTION_SHOW_ON_MAP == 0 findItem(R.id.menu_slideshow).isVisible = visibleBottomActions and BOTTOM_ACTION_SLIDESHOW == 0 @@ -593,6 +593,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val photoFragment = getCurrentPhotoFragment() ?: return@Thread saveRotatedImageToFile(currPath, it, photoFragment.mCurrentRotationDegrees, true) { toast(R.string.file_saved) + getCurrentPhotoFragment()?.mCurrentRotationDegrees = 0 invalidateOptionsMenu() } }.start() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 86770742d..23f1aca8c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -481,6 +481,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onImageRotation(degrees: Int) { if (mCurrentRotationDegrees != degrees) { loadBitmap(degrees, false) + activity?.invalidateOptionsMenu() } mCurrentRotationDegrees = degrees }