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 ec99f9352..d7797644a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt @@ -148,19 +148,23 @@ fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll loadJpg(path, target, cropThumbnails) } } else if (path.isGif()) { - try { - val gifDrawable = GifDrawable(path) - target.setImageDrawable(gifDrawable) - if (animateGifs) { - gifDrawable.start() - } else { - gifDrawable.stop() - } + if (animateGifs) { + try { + val gifDrawable = GifDrawable(path) + target.setImageDrawable(gifDrawable) + if (animateGifs) { + gifDrawable.start() + } else { + gifDrawable.stop() + } - target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER - } catch (e: Exception) { - loadJpg(path, target, cropThumbnails) - } catch (e: OutOfMemoryError) { + target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER + } catch (e: Exception) { + loadJpg(path, target, cropThumbnails) + } catch (e: OutOfMemoryError) { + loadJpg(path, target, cropThumbnails) + } + } else { loadJpg(path, target, cropThumbnails) } }