reordering some PhotoFragment functions

This commit is contained in:
tibbi 2019-01-13 20:02:11 +01:00
parent bb038aa47b
commit 57e7fb03d1

View file

@ -204,6 +204,33 @@ class PhotoFragment : ViewPagerFragment() {
storeStateVariables() storeStateVariables()
} }
override fun onDestroyView() {
super.onDestroyView()
if (activity?.isDestroyed == false) {
mView.subsampling_view.recycle()
}
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// avoid GIFs being skewed, played in wrong aspect ratio
if (mMedium.isGIF()) {
mView.onGlobalLayout {
Handler().postDelayed({
loadGif()
}, 50)
}
} else {
hideZoomableView()
loadImage()
}
initExtendedDetails()
updateInstantSwitchWidths()
}
override fun setMenuVisibility(menuVisible: Boolean) { override fun setMenuVisibility(menuVisible: Boolean) {
super.setMenuVisibility(menuVisible) super.setMenuVisibility(menuVisible)
mIsFragmentVisible = menuVisible mIsFragmentVisible = menuVisible
@ -537,33 +564,6 @@ class PhotoFragment : ViewPagerFragment() {
} }
} }
override fun onDestroyView() {
super.onDestroyView()
if (activity?.isDestroyed == false) {
mView.subsampling_view.recycle()
}
mIoadZoomableViewHandler.removeCallbacksAndMessages(null)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
// avoid GIFs being skewed, played in wrong aspect ratio
if (mMedium.isGIF()) {
mView.onGlobalLayout {
Handler().postDelayed({
loadGif()
}, 50)
}
} else {
hideZoomableView()
loadImage()
}
initExtendedDetails()
updateInstantSwitchWidths()
}
private fun hideZoomableView() { private fun hideZoomableView() {
if (context?.config?.allowZoomingImages == true) { if (context?.config?.allowZoomingImages == true) {
mIsSubsamplingVisible = false mIsSubsamplingVisible = false