check if we are trying to rotate a photo fragment
This commit is contained in:
parent
c0fcb48d9c
commit
814b0cc3b6
1 changed files with 8 additions and 2 deletions
|
@ -218,11 +218,17 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
|
|
||||||
private fun rotateImage(degrees: Float) {
|
private fun rotateImage(degrees: Float) {
|
||||||
mRotationDegrees = (mRotationDegrees + degrees) % 360
|
mRotationDegrees = (mRotationDegrees + degrees) % 360
|
||||||
getCurrentFragment().rotateImageViewBy(mRotationDegrees)
|
getCurrentFragment()?.rotateImageViewBy(mRotationDegrees)
|
||||||
supportInvalidateOptionsMenu()
|
supportInvalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCurrentFragment() = ((view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem) as PhotoFragment)
|
private fun getCurrentFragment(): PhotoFragment? {
|
||||||
|
val fragment = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem)
|
||||||
|
return if (fragment is PhotoFragment)
|
||||||
|
fragment
|
||||||
|
else
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
if (getCurrentMedium() != null)
|
if (getCurrentMedium() != null)
|
||||||
|
|
Loading…
Reference in a new issue