diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index f5d278619..b5efcc49c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -39,10 +39,12 @@ import java.io.FileOutputStream import java.io.IOException class PhotoFragment : ViewPagerFragment() { - lateinit var medium: Medium - lateinit var view: ViewGroup private var isFragmentVisible = false private var wasInit = false + private var storedShowExtendedDetails = false + + lateinit var view: ViewGroup + lateinit var medium: Medium override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { view = inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup @@ -104,6 +106,18 @@ class PhotoFragment : ViewPagerFragment() { return view } + override fun onPause() { + super.onPause() + storedShowExtendedDetails = context.config.showExtendedDetails + } + + override fun onResume() { + super.onResume() + if (wasInit && context.config.showExtendedDetails != storedShowExtendedDetails) { + checkExtendedDetails() + } + } + override fun setMenuVisibility(menuVisible: Boolean) { super.setMenuVisibility(menuVisible) isFragmentVisible = menuVisible diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 4c36de74a..c457e08fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -43,6 +43,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFullscreen = false private var mIsFragmentVisible = false private var mPlayOnPrepare = false + private var mStoredShowExtendedDetails = false private var mCurrTime = 0 private var mDuration = 0 @@ -87,6 +88,24 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee activity.updateTextColors(mView.video_holder) mView.video_volume_controller.beVisibleIf(context.config.allowVideoGestures) mView.video_brightness_controller.beVisibleIf(context.config.allowVideoGestures) + + if (context.config.showExtendedDetails != mStoredShowExtendedDetails) { + checkExtendedDetails() + } + } + + override fun onPause() { + super.onPause() + pauseVideo() + mIsFragmentVisible = false + mStoredShowExtendedDetails = context.config.showExtendedDetails + } + + override fun onDestroy() { + super.onDestroy() + if (activity?.isChangingConfigurations == false) { + cleanup() + } } private fun setupPlayer() { @@ -396,19 +415,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mMediaPlayer!!.pause() } - override fun onPause() { - super.onPause() - pauseVideo() - mIsFragmentVisible = false - } - - override fun onDestroy() { - super.onDestroy() - if (activity?.isChangingConfigurations == false) { - cleanup() - } - } - private fun cleanup() { pauseVideo() mCurrTimeView?.text = 0.getFormattedDuration()