changing the current fragment retriever at viewpager activity
This commit is contained in:
parent
66561179bd
commit
49df8130cf
1 changed files with 4 additions and 8 deletions
|
@ -306,17 +306,13 @@ 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()?.let {
|
||||||
|
(it as? PhotoFragment)?.rotateImageViewBy(mRotationDegrees)
|
||||||
|
}
|
||||||
supportInvalidateOptionsMenu()
|
supportInvalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCurrentFragment(): PhotoFragment? {
|
private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem)
|
||||||
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