diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index e80f14e8c..200b2897b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -157,7 +157,7 @@ fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER } catch (e: Exception) { - showErrorToast(e) + loadJpg(path, target, cropThumbnails) } } } 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 5decd01bd..11291468c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -160,6 +160,14 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { + loadGif() + } else { + loadBitmap() + } + } + + private fun loadGif() { + try { gifDrawable = if (medium.path.startsWith("content://") || medium.path.startsWith("file://")) { GifDrawable(context.contentResolver, Uri.parse(medium.path)) } else { @@ -171,7 +179,8 @@ class PhotoFragment : ViewPagerFragment() { } view.gif_view.setImageDrawable(gifDrawable) - } else { + } catch (e: Exception) { + gifDrawable = null loadBitmap() } }