From c1af0bda753d0e7bbcc7ce716cbcbf831f4b7edb Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Feb 2019 19:36:50 +0100 Subject: [PATCH] allow loading subsampling view even with some rotation set --- app/build.gradle | 2 +- .../gallery/pro/fragments/PhotoFragment.kt | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d42e9fe64..f1c2c4b9d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -75,7 +75,7 @@ dependencies { implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.caverock:androidsvg-aar:1.3' implementation 'com.github.tibbi:gestureviews:985ba285fb' - implementation 'com.github.tibbi:subsampling-scale-image-view:224582bc99' + implementation 'com.github.tibbi:subsampling-scale-image-view:f8559f7f43' kapt 'com.github.bumptech.glide:compiler:4.8.0' // keep it here too, not just in Commons, else loading SVGs wont work kapt 'androidx.room:room-compiler:2.0.0' 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 6bea26c56..a84d5bf37 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 @@ -380,7 +380,7 @@ class PhotoFragment : ViewPagerFragment() { } override fun onResourceReady(resource: Drawable?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { - if (mIsFragmentVisible && degrees == 0) { + if (mIsFragmentVisible) { scheduleZoomableView() } return false @@ -408,7 +408,7 @@ class PhotoFragment : ViewPagerFragment() { picasso.into(mView.gestures_view, object : Callback { override fun onSuccess() { mView.gestures_view.controller.settings.isZoomEnabled = degrees != 0 || context?.config?.allowZoomingImages == false - if (mIsFragmentVisible && degrees == 0) { + if (mIsFragmentVisible) { scheduleZoomableView() } } @@ -429,7 +429,7 @@ class PhotoFragment : ViewPagerFragment() { private fun scheduleZoomableView() { mLoadZoomableViewHandler.removeCallbacksAndMessages(null) mLoadZoomableViewHandler.postDelayed({ - if (mIsFragmentVisible && context?.config?.allowZoomingImages == true && mMedium.isImage() && !mIsSubsamplingVisible && mCurrentRotationDegrees == 0) { + if (mIsFragmentVisible && context?.config?.allowZoomingImages == true && mMedium.isImage() && !mIsSubsamplingVisible) { addZoomableView() } }, ZOOMABLE_VIEW_LOAD_DELAY) @@ -459,7 +459,7 @@ class PhotoFragment : ViewPagerFragment() { beVisible() isQuickScaleEnabled = config.oneFingerZoom isOneToOneZoomEnabled = config.allowOneToOneZoom - orientation = rotation + orientation = rotation + mCurrentRotationDegrees setImage(path) onImageEventListener = object : SubsamplingScaleImageView.OnImageEventListener { override fun onReady() { @@ -550,7 +550,6 @@ class PhotoFragment : ViewPagerFragment() { fun rotateImageViewBy(degrees: Int) { mCurrentRotationDegrees = degrees mLoadZoomableViewHandler.removeCallbacksAndMessages(null) - mView.subsampling_view.beGone() mIsSubsamplingVisible = false loadBitmap(degrees) }