mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
check if Image first, that will be the most frequent
This commit is contained in:
@@ -187,7 +187,20 @@ fun SimpleActivity.removeNoMedia(path: String, callback: () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Activity.loadImage(path: String, size: Int, target: MyImageView) {
|
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) {
|
if (MediaAdapter.animateGifs) {
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load(path)
|
.load(path)
|
||||||
@@ -204,18 +217,5 @@ fun Activity.loadImage(path: String, size: Int, target: MyImageView) {
|
|||||||
.centerCrop()
|
.centerCrop()
|
||||||
.into(target)
|
.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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user