mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
take the Crop Thumbnails setting into consideration when displaying thumbnails
This commit is contained in:
parent
a5faf7a0a5
commit
e9115530ea
1 changed files with 46 additions and 26 deletions
|
@ -188,37 +188,57 @@ fun SimpleActivity.removeNoMedia(path: String, callback: () -> Unit) {
|
||||||
fun Activity.loadImage(path: String, target: MySquareImageView) {
|
fun Activity.loadImage(path: String, target: MySquareImageView) {
|
||||||
if (path.isImageFast() || path.isVideoFast()) {
|
if (path.isImageFast() || path.isVideoFast()) {
|
||||||
if (path.isPng()) {
|
if (path.isPng()) {
|
||||||
Glide.with(this)
|
loadPng(path, target)
|
||||||
|
} else {
|
||||||
|
loadJpg(path, target)
|
||||||
|
}
|
||||||
|
} else if (path.isGif()) {
|
||||||
|
if (config.animateGifs) {
|
||||||
|
loadAnimatedGif(path, target)
|
||||||
|
} else {
|
||||||
|
loadStaticGif(path, target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Activity.loadPng(path: String, target: MySquareImageView) {
|
||||||
|
val builder = Glide.with(this)
|
||||||
.load(path)
|
.load(path)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESULT)
|
.diskCacheStrategy(DiskCacheStrategy.RESULT)
|
||||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
.format(DecodeFormat.PREFER_ARGB_8888)
|
||||||
.centerCrop()
|
|
||||||
.into(target)
|
if (config.cropThumbnails) builder.centerCrop() else builder.fitCenter()
|
||||||
} else {
|
builder.into(target)
|
||||||
Glide.with(this)
|
}
|
||||||
|
|
||||||
|
fun Activity.loadJpg(path: String, target: MySquareImageView) {
|
||||||
|
val builder = Glide.with(this)
|
||||||
.load(path)
|
.load(path)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESULT)
|
.diskCacheStrategy(DiskCacheStrategy.RESULT)
|
||||||
.centerCrop()
|
|
||||||
.crossFade()
|
.crossFade()
|
||||||
.into(target)
|
|
||||||
}
|
if (config.cropThumbnails) builder.centerCrop() else builder.fitCenter()
|
||||||
} else if (path.isGif()) {
|
builder.into(target)
|
||||||
if (config.animateGifs) {
|
}
|
||||||
Glide.with(this)
|
|
||||||
|
fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) {
|
||||||
|
val builder = Glide.with(this)
|
||||||
.load(path)
|
.load(path)
|
||||||
.asGif()
|
.asGif()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||||
.centerCrop()
|
|
||||||
.crossFade()
|
.crossFade()
|
||||||
.into(target)
|
|
||||||
} else {
|
if (config.cropThumbnails) builder.centerCrop() else builder.fitCenter()
|
||||||
Glide.with(this)
|
builder.into(target)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Activity.loadStaticGif(path: String, target: MySquareImageView) {
|
||||||
|
val builder = Glide.with(this)
|
||||||
.load(path)
|
.load(path)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||||
.centerCrop()
|
|
||||||
.into(target)
|
if (config.cropThumbnails) builder.centerCrop() else builder.fitCenter()
|
||||||
}
|
builder.into(target)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue