nope, do not use Glide for loading non-animating gifs

This commit is contained in:
tibbi 2018-01-04 18:40:44 +01:00
parent 129858119d
commit 1204eea382
1 changed files with 12 additions and 16 deletions

View File

@ -148,23 +148,19 @@ fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll
loadJpg(path, target, cropThumbnails)
}
} else if (path.isGif()) {
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) {
loadJpg(path, target, cropThumbnails)
try {
val gifDrawable = GifDrawable(path)
target.setImageDrawable(gifDrawable)
if (animateGifs) {
gifDrawable.start()
} else {
gifDrawable.stop()
}
} else {
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)
}
}