fix images being totally zoomed in after device rotation

This commit is contained in:
tibbi 2018-10-19 21:52:45 +02:00
parent 1c19b00df9
commit fda3569aa1
2 changed files with 17 additions and 7 deletions

View file

@ -33,7 +33,10 @@ import com.simplemobiletools.gallery.activities.PanoramaActivity
import com.simplemobiletools.gallery.activities.PhotoActivity import com.simplemobiletools.gallery.activities.PhotoActivity
import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity
import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.extensions.*
import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.helpers.MEDIUM
import com.simplemobiletools.gallery.helpers.PATH
import com.simplemobiletools.gallery.helpers.PicassoDecoder
import com.simplemobiletools.gallery.helpers.PicassoRegionDecoder
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
import com.simplemobiletools.gallery.svg.SvgSoftwareLayerSetter import com.simplemobiletools.gallery.svg.SvgSoftwareLayerSetter
import com.squareup.picasso.Callback import com.squareup.picasso.Callback
@ -216,10 +219,7 @@ class PhotoFragment : ViewPagerFragment() {
if (isVisible) { if (isVisible) {
scheduleZoomableView() scheduleZoomableView()
} else { } else {
isSubsamplingVisible = false hideZoomableView()
view.subsampling_view.recycle()
view.subsampling_view.beGone()
loadZoomableViewHandler.removeCallbacksAndMessages(null)
} }
} }
@ -370,7 +370,7 @@ class PhotoFragment : ViewPagerFragment() {
maxScale = 10f maxScale = 10f
beVisible() beVisible()
isQuickScaleEnabled = context.config.oneFingerZoom isQuickScaleEnabled = context.config.oneFingerZoom
setResetScaleOnSizeChange(context.config.screenRotation != ROTATE_BY_ASPECT_RATIO) setResetScaleOnSizeChange(false)
setImage(ImageSource.uri(path)) setImage(ImageSource.uri(path))
orientation = rotation orientation = rotation
setEagerLoadingEnabled(false) setEagerLoadingEnabled(false)
@ -521,12 +521,22 @@ class PhotoFragment : ViewPagerFragment() {
}, 50) }, 50)
} }
} else { } else {
hideZoomableView()
loadImage() loadImage()
} }
initExtendedDetails() initExtendedDetails()
} }
private fun hideZoomableView() {
if (context?.config?.allowZoomingImages == true) {
isSubsamplingVisible = false
view.subsampling_view.recycle()
view.subsampling_view.beGone()
loadZoomableViewHandler.removeCallbacksAndMessages(null)
}
}
private fun photoClicked() { private fun photoClicked() {
listener?.fragmentClicked() listener?.fragmentClicked()
} }

View file

@ -112,7 +112,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
} }
mExoPlayer = ExoPlayerFactory.newSimpleInstance(context, DefaultTrackSelector()) mExoPlayer = ExoPlayerFactory.newSimpleInstance(context, DefaultTrackSelector())
mExoPlayer!!.setSeekParameters(SeekParameters.CLOSEST_SYNC) mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC
initExoPlayerListeners() initExoPlayerListeners()
medium.path.getVideoResolution()?.apply { medium.path.getVideoResolution()?.apply {