let's try using GlideDecoder at fullscreen media

This commit is contained in:
tibbi 2017-11-08 20:35:35 +01:00
parent d0f7eb9fb1
commit 19a0621cab
3 changed files with 5 additions and 6 deletions

View File

@ -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'

View File

@ -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))

View File

@ -42,11 +42,9 @@ class GlideDecoder : ImageDecoder {
}
private fun drawableToBitmap(drawable: Drawable): Bitmap {
if (drawable is BitmapDrawable) {
if (drawable.bitmap != null) {
if (drawable is BitmapDrawable && drawable.bitmap != null) {
return drawable.bitmap
}
}
val bitmap = if (drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0) {
Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)