From 0728c1b9e10b0a8a435a90163ef2ec6409610408 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 17 Mar 2017 22:04:02 +0100 Subject: [PATCH] check if Image first, that will be the most frequent --- .../gallery/extensions/activity.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) 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 801fdbd40..a18da0f8c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -187,7 +187,20 @@ fun SimpleActivity.removeNoMedia(path: String, callback: () -> Unit) { } fun Activity.loadImage(path: String, size: Int, target: MyImageView) { - if (path.isGif()) { + if (path.isImageFast()) { + Picasso.with(this) + .load("file:$path") + .resize(size, size) + .centerCrop() + .into(target) + } else if (path.isVideoFast()) { + Glide.with(this) + .load(path) + .diskCacheStrategy(DiskCacheStrategy.RESULT) + .centerCrop() + .crossFade() + .into(target) + } else if (path.isGif()) { if (MediaAdapter.animateGifs) { Glide.with(this) .load(path) @@ -204,18 +217,5 @@ fun Activity.loadImage(path: String, size: Int, target: MyImageView) { .centerCrop() .into(target) } - } else if (path.isVideoFast()) { - Glide.with(this) - .load(path) - .diskCacheStrategy(DiskCacheStrategy.RESULT) - .centerCrop() - .crossFade() - .into(target) - } else { - Picasso.with(this) - .load("file:$path") - .resize(size, size) - .centerCrop() - .into(target) } }