ViewImageFragment: upgrade BigImageView to 1.6.6, enable swiping for all kinds of embedded views

This commit is contained in:
Alibek Omarov 2020-07-26 16:06:21 +03:00
parent 483b847120
commit fe0e68ba5c
2 changed files with 7 additions and 9 deletions

View File

@ -178,9 +178,9 @@ dependencies {
implementation "com.github.connyduck:sparkbutton:4.0.0"
implementation 'com.github.piasy:BigImageViewer:1.6.5'
implementation 'com.github.piasy:GlideImageLoader:1.6.5'
implementation 'com.github.piasy:GlideImageViewFactory:1.6.5'
implementation 'com.github.piasy:BigImageViewer:1.6.6'
implementation 'com.github.piasy:GlideImageLoader:1.6.6'
implementation 'com.github.piasy:GlideImageViewFactory:1.6.6'
implementation "com.mikepenz:materialdrawer:$materialdrawerVersion"
implementation "com.mikepenz:materialdrawer-iconics:$materialdrawerVersion"

View File

@ -118,7 +118,8 @@ class ViewImageFragment : ViewMediaFragment() {
swipeStartedWithOneFinger = false
}
MotionEvent.ACTION_MOVE -> {
if(swipeStartedWithOneFinger && photoView.ssiv.scale <= photoView.ssiv.minScale) {
if(swipeStartedWithOneFinger &&
(photoView.ssiv == null || photoView.ssiv.scale <= photoView.ssiv.minScale)) {
val diff = event.rawY - lastY
// This code is to prevent transformations during page scrolling
// If we are already translating or we reached the threshold, then transform.
@ -149,7 +150,6 @@ class ViewImageFragment : ViewMediaFragment() {
}
})
// photoView.setOnTouchListener(this)
photoView.setImageLoaderCallback(imageLoaderCallback)
photoView.setImageViewFactory(GlideImageViewFactory())
@ -266,10 +266,8 @@ class ViewImageFragment : ViewMediaFragment() {
override fun onSuccess(image: File?) {
if(!showingPreview) {
progressBar?.hide()
photoView.ssiv?.let {
it.orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF
it.setOnTouchListener(imageOnTouchListener)
}
photoView.ssiv?.orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF
photoView.mainView?.setOnTouchListener(imageOnTouchListener)
}
}