From 43d49beca038a4df82612ebe2725ae4b3ada7970 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Nov 2017 21:22:35 +0100 Subject: [PATCH] split the Rotate button to 3 orientations --- .../gallery/activities/ViewPagerActivity.kt | 8 +++++--- app/src/main/res/menu/menu_viewpager.xml | 14 +++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 6abee7975..b878c0d01 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -286,7 +286,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.menu_edit -> openEditor(Uri.fromFile(getCurrentFile())) R.id.menu_properties -> showProperties() R.id.menu_show_on_map -> showOnMap() - R.id.menu_rotate -> rotateImage() + R.id.menu_rotate_right -> rotateImage(90) + R.id.menu_rotate_left -> rotateImage(270) + R.id.menu_rotate_one_eighty -> rotateImage(180) R.id.menu_lock_orientation -> toggleLockOrientation() R.id.menu_save_as -> saveImageAs() R.id.menu_settings -> launchSettings() @@ -469,8 +471,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - private fun rotateImage() { - mRotationDegrees = (mRotationDegrees + 90) % 360 + private fun rotateImage(degrees: Int) { + mRotationDegrees = (mRotationDegrees + degrees) % 360 getCurrentFragment()?.let { (it as? PhotoFragment)?.rotateImageViewBy(mRotationDegrees) } diff --git a/app/src/main/res/menu/menu_viewpager.xml b/app/src/main/res/menu/menu_viewpager.xml index f22a0afb3..047c77d9f 100644 --- a/app/src/main/res/menu/menu_viewpager.xml +++ b/app/src/main/res/menu/menu_viewpager.xml @@ -21,7 +21,19 @@ android:id="@+id/menu_rotate" android:icon="@drawable/ic_rotate_right" android:title="@string/rotate" - app:showAsAction="ifRoom"/> + app:showAsAction="ifRoom"> + + + + + +