mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
split the Rotate button to 3 orientations
This commit is contained in:
parent
b41f1e97e6
commit
43d49beca0
2 changed files with 18 additions and 4 deletions
|
@ -286,7 +286,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
R.id.menu_edit -> openEditor(Uri.fromFile(getCurrentFile()))
|
R.id.menu_edit -> openEditor(Uri.fromFile(getCurrentFile()))
|
||||||
R.id.menu_properties -> showProperties()
|
R.id.menu_properties -> showProperties()
|
||||||
R.id.menu_show_on_map -> showOnMap()
|
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_lock_orientation -> toggleLockOrientation()
|
||||||
R.id.menu_save_as -> saveImageAs()
|
R.id.menu_save_as -> saveImageAs()
|
||||||
R.id.menu_settings -> launchSettings()
|
R.id.menu_settings -> launchSettings()
|
||||||
|
@ -469,8 +471,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rotateImage() {
|
private fun rotateImage(degrees: Int) {
|
||||||
mRotationDegrees = (mRotationDegrees + 90) % 360
|
mRotationDegrees = (mRotationDegrees + degrees) % 360
|
||||||
getCurrentFragment()?.let {
|
getCurrentFragment()?.let {
|
||||||
(it as? PhotoFragment)?.rotateImageViewBy(mRotationDegrees)
|
(it as? PhotoFragment)?.rotateImageViewBy(mRotationDegrees)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,19 @@
|
||||||
android:id="@+id/menu_rotate"
|
android:id="@+id/menu_rotate"
|
||||||
android:icon="@drawable/ic_rotate_right"
|
android:icon="@drawable/ic_rotate_right"
|
||||||
android:title="@string/rotate"
|
android:title="@string/rotate"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_rotate_right"
|
||||||
|
android:title="@string/rotate_right"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_rotate_left"
|
||||||
|
android:title="@string/rotate_left"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/menu_rotate_one_eighty"
|
||||||
|
android:title="@string/rotate_one_eighty"/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_share_2"
|
android:id="@+id/menu_share_2"
|
||||||
android:icon="@drawable/ic_share"
|
android:icon="@drawable/ic_share"
|
||||||
|
|
Loading…
Reference in a new issue