diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index fccb577c5..d6386c5a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -29,7 +29,7 @@ class PhotoFragment : ViewPagerFragment(), View.OnClickListener { subsamplingView = view.photo_view if (medium.isGif()) { subsamplingView.visibility = View.GONE - view.gif_view.apply { + view.glide_view.apply { visibility = View.VISIBLE Glide.with(context).load(medium.path).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).into(this) setOnClickListener(this@PhotoFragment) @@ -42,6 +42,31 @@ class PhotoFragment : ViewPagerFragment(), View.OnClickListener { maxScale = 4f setMinimumTileDpi(100) setOnClickListener(this@PhotoFragment) + setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener { + override fun onImageLoaded() { + } + + override fun onReady() { + } + + override fun onTileLoadError(p0: Exception?) { + } + + override fun onPreviewReleased() { + } + + override fun onImageLoadError(p0: Exception?) { + subsamplingView.visibility = View.GONE + view.glide_view.apply { + visibility = View.VISIBLE + Glide.with(context).load(medium.path).diskCacheStrategy(DiskCacheStrategy.NONE).into(this) + setOnClickListener(this@PhotoFragment) + } + } + + override fun onPreviewLoadError(p0: Exception?) { + } + }) } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index bf7420d63..463630ace 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -6,13 +6,12 @@ android:layout_height="match_parent">