diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 1512c8ecc..df397e332 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -8,6 +8,7 @@ import com.bignerdranch.android.multiselector.ModalMultiSelectorCallback import com.bignerdranch.android.multiselector.MultiSelector import com.bignerdranch.android.multiselector.SwappingHolder import com.bumptech.glide.Glide +import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.signature.StringSignature import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask @@ -16,11 +17,11 @@ import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder import com.simplemobiletools.filepicker.extensions.scanPaths import com.simplemobiletools.filepicker.extensions.toast import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog -import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.dialogs.CopyDialog import com.simplemobiletools.gallery.dialogs.RenameDirectoryDialog +import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.models.Directory import kotlinx.android.synthetic.main.directory_item.view.* import kotlinx.android.synthetic.main.directory_tmb.view.* @@ -223,9 +224,12 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, val timestampSignature = StringSignature(medium.timestamp.toString()) if (medium.isGif()) { Glide.with(activity).load(path).asGif().diskCacheStrategy(DiskCacheStrategy.NONE).signature(timestampSignature).into(itemView.medium_thumbnail) + } else if (medium.isPng()) { + Glide.with(activity).load(path).asBitmap().format(DecodeFormat.PREFER_ARGB_8888).diskCacheStrategy(DiskCacheStrategy.RESULT) + .signature(timestampSignature).placeholder(R.color.tmb_background).centerCrop().into(itemView.medium_thumbnail) } else { Glide.with(activity).load(path).diskCacheStrategy(DiskCacheStrategy.RESULT).signature(timestampSignature) .placeholder(R.color.tmb_background).centerCrop().crossFade().into(itemView.medium_thumbnail) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index b32c301cd..ba5b01eb4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -13,6 +13,8 @@ class Medium(val name: String, var path: String, val isVideo: Boolean, val times fun isGif() = path.toLowerCase().endsWith(".gif") + fun isPng() = path.toLowerCase().endsWith(".png") + fun isImage() = !isGif() && !isVideo fun getMimeType() = if (isVideo) "video/*" else "image/*"