From 19a0621cab0dd757e972c4c7b42552929d60a145 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Nov 2017 20:35:35 +0100 Subject: [PATCH] let's try using GlideDecoder at fullscreen media --- app/build.gradle | 2 +- .../simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 ++- .../com/simplemobiletools/gallery/helpers/GlideDecoder.kt | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9d2b84b32..1238f800c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { dependencies { compile 'com.simplemobiletools:commons:2.37.6' - compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' + compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.7.2' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.google.code.gson:gson:2.8.2' 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 a18d9ea1d..b213073cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.PhotoActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* +import com.simplemobiletools.gallery.helpers.GlideDecoder import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -226,7 +227,7 @@ class PhotoFragment : ViewPagerFragment() { private fun addZoomableView() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { - //setBitmapDecoderClass(GlideDecoder::class.java) // causing random crashes on Android 7+ + setBitmapDecoderClass(GlideDecoder::class.java) // was causing random crashes on Android 7+ 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 fbddb788b..78ea3c9dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -42,10 +42,8 @@ class GlideDecoder : ImageDecoder { } private fun drawableToBitmap(drawable: Drawable): Bitmap { - if (drawable is BitmapDrawable) { - if (drawable.bitmap != null) { - return drawable.bitmap - } + if (drawable is BitmapDrawable && drawable.bitmap != null) { + return drawable.bitmap } val bitmap = if (drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0) {