allow loading subsampling view even with some rotation set

This commit is contained in:
tibbi 2019-02-06 19:36:50 +01:00
parent e4ac69004d
commit c1af0bda75
2 changed files with 5 additions and 6 deletions

View file

@ -75,7 +75,7 @@ dependencies {
implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.caverock:androidsvg-aar:1.3' implementation 'com.caverock:androidsvg-aar:1.3'
implementation 'com.github.tibbi:gestureviews:985ba285fb' 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 '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' kapt 'androidx.room:room-compiler:2.0.0'

View file

@ -380,7 +380,7 @@ class PhotoFragment : ViewPagerFragment() {
} }
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
if (mIsFragmentVisible && degrees == 0) { if (mIsFragmentVisible) {
scheduleZoomableView() scheduleZoomableView()
} }
return false return false
@ -408,7 +408,7 @@ class PhotoFragment : ViewPagerFragment() {
picasso.into(mView.gestures_view, object : Callback { picasso.into(mView.gestures_view, object : Callback {
override fun onSuccess() { override fun onSuccess() {
mView.gestures_view.controller.settings.isZoomEnabled = degrees != 0 || context?.config?.allowZoomingImages == false mView.gestures_view.controller.settings.isZoomEnabled = degrees != 0 || context?.config?.allowZoomingImages == false
if (mIsFragmentVisible && degrees == 0) { if (mIsFragmentVisible) {
scheduleZoomableView() scheduleZoomableView()
} }
} }
@ -429,7 +429,7 @@ class PhotoFragment : ViewPagerFragment() {
private fun scheduleZoomableView() { private fun scheduleZoomableView() {
mLoadZoomableViewHandler.removeCallbacksAndMessages(null) mLoadZoomableViewHandler.removeCallbacksAndMessages(null)
mLoadZoomableViewHandler.postDelayed({ mLoadZoomableViewHandler.postDelayed({
if (mIsFragmentVisible && context?.config?.allowZoomingImages == true && mMedium.isImage() && !mIsSubsamplingVisible && mCurrentRotationDegrees == 0) { if (mIsFragmentVisible && context?.config?.allowZoomingImages == true && mMedium.isImage() && !mIsSubsamplingVisible) {
addZoomableView() addZoomableView()
} }
}, ZOOMABLE_VIEW_LOAD_DELAY) }, ZOOMABLE_VIEW_LOAD_DELAY)
@ -459,7 +459,7 @@ class PhotoFragment : ViewPagerFragment() {
beVisible() beVisible()
isQuickScaleEnabled = config.oneFingerZoom isQuickScaleEnabled = config.oneFingerZoom
isOneToOneZoomEnabled = config.allowOneToOneZoom isOneToOneZoomEnabled = config.allowOneToOneZoom
orientation = rotation orientation = rotation + mCurrentRotationDegrees
setImage(path) setImage(path)
onImageEventListener = object : SubsamplingScaleImageView.OnImageEventListener { onImageEventListener = object : SubsamplingScaleImageView.OnImageEventListener {
override fun onReady() { override fun onReady() {
@ -550,7 +550,6 @@ class PhotoFragment : ViewPagerFragment() {
fun rotateImageViewBy(degrees: Int) { fun rotateImageViewBy(degrees: Int) {
mCurrentRotationDegrees = degrees mCurrentRotationDegrees = degrees
mLoadZoomableViewHandler.removeCallbacksAndMessages(null) mLoadZoomableViewHandler.removeCallbacksAndMessages(null)
mView.subsampling_view.beGone()
mIsSubsamplingVisible = false mIsSubsamplingVisible = false
loadBitmap(degrees) loadBitmap(degrees)
} }