From 99facd2e99257b584fba4c96cab69cae23ce4eb4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Feb 2019 16:21:27 +0100 Subject: [PATCH] fix #1243, reset video and gif scale on device rotation --- app/build.gradle | 2 +- .../gallery/pro/activities/VideoPlayerActivity.kt | 3 +++ .../simplemobiletools/gallery/pro/fragments/PhotoFragment.kt | 1 + .../simplemobiletools/gallery/pro/fragments/VideoFragment.kt | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 78965e1f4..c866997af 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,7 +74,7 @@ dependencies { implementation 'info.androidhive:imagefilters:1.0.7' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.caverock:androidsvg-aar:1.3' - implementation 'com.github.tibbi:gestureviews:985ba285fb' + implementation 'com.github.tibbi:gestureviews:bd0a8e67a1' implementation 'com.github.tibbi:subsampling-scale-image-view:2fe77ff361' kapt 'com.github.bumptech.glide:compiler:4.8.0' // keep it here too, not just in Commons, else loading SVGs wont work diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 7fc2138c1..4578e906e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -132,6 +132,9 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen super.onConfigurationChanged(newConfig) setVideoSize() initTimeHolder() + video_surface_frame.onGlobalLayout { + video_surface_frame.controller.resetState() + } } private fun setupOrientation() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 083a1ad4f..bb3c38d68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -242,6 +242,7 @@ class PhotoFragment : ViewPagerFragment() { mView.onGlobalLayout { measureScreen() Handler().postDelayed({ + mView.gif_view_frame.controller.resetState() loadGif() }, 50) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 0b0258d9a..7cd46cb6e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -246,6 +246,9 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S initTimeHolder() checkExtendedDetails() updateInstantSwitchWidths() + mView.video_surface_frame.onGlobalLayout { + mView.video_surface_frame.controller.resetState() + } } override fun onSaveInstanceState(outState: Bundle) { @@ -253,7 +256,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S outState.putInt(PROGRESS, mCurrTime) } - private fun storeStateVariables() { mConfig.apply { mStoredShowExtendedDetails = showExtendedDetails