diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index cffb769b6..493e8a980 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.SLIDESHOW_DEFAULT_INTERVAL import kotlinx.android.synthetic.main.dialog_slideshow.view.* - class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { val view: View diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 2e8b5a2ce..8a1f24ffc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -167,7 +167,7 @@ class PhotoFragment : ViewPagerFragment() { val options = RequestOptions() .signature(medium.path.getFileSignature()) .format(DecodeFormat.PREFER_ARGB_8888) - .diskCacheStrategy(DiskCacheStrategy.NONE) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .override(targetWidth, targetHeight) Glide.with(this) @@ -201,6 +201,7 @@ class PhotoFragment : ViewPagerFragment() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { setBitmapDecoderClass(GlideDecoder::class.java) + setMaxTileSize(10000) maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index 9cba5dbef..fe7c7f9e5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -11,17 +11,25 @@ import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions +import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder +import com.simplemobiletools.gallery.activities.ViewPagerActivity +import com.simplemobiletools.gallery.extensions.getFileSignature class GlideDecoder : ImageDecoder { override fun decode(context: Context, uri: Uri): Bitmap { val exif = android.media.ExifInterface(uri.path) val orientation = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL) + val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth + val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight + val options = RequestOptions() + .signature(uri.path.getFileSignature()) .format(DecodeFormat.PREFER_ARGB_8888) - .diskCacheStrategy(DiskCacheStrategy.NONE) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .transform(GlideRotateTransformation(context, getRotationDegrees(orientation))) + .override(targetWidth, targetHeight) val drawable = Glide.with(context) .load(uri)