diff --git a/app/build.gradle b/app/build.gradle index a41dd9ceb..89000c9c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.16.4' + compile 'com.simplemobiletools:commons:2.16.6' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'com.bignerdranch.android:recyclerview-multiselect:0.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 7545302c9..34ed122cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -160,14 +160,15 @@ class PhotoFragment : ViewPagerFragment() { if (degrees == 0f) { val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight + Glide.with(this) .load(medium.path) .asBitmap() - .format(DecodeFormat.PREFER_ARGB_8888) + .format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565) .diskCacheStrategy(DiskCacheStrategy.NONE) .override(targetWidth, targetHeight) .listener(object : RequestListener { - override fun onException(e: java.lang.Exception?, model: String?, target: Target?, isFirstResource: Boolean): Boolean { + override fun onException(e: Exception?, model: String?, target: Target?, isFirstResource: Boolean): Boolean { return false } @@ -182,7 +183,6 @@ class PhotoFragment : ViewPagerFragment() { .load(medium.path) .asBitmap() .transform(GlideRotateTransformation(context, degrees)) - .format(DecodeFormat.PREFER_ARGB_8888) .thumbnail(0.2f) .diskCacheStrategy(DiskCacheStrategy.NONE) .into(view.photo_view) @@ -205,26 +205,34 @@ class PhotoFragment : ViewPagerFragment() { background = ColorDrawable(context.config.backgroundColor) } - override fun onTileLoadError(p0: java.lang.Exception?) { + override fun onTileLoadError(e: Exception?) { } override fun onPreviewReleased() { } - override fun onImageLoadError(p0: java.lang.Exception?) { + override fun onImageLoadError(e: Exception?) { background = ColorDrawable(Color.TRANSPARENT) + + beGone() } - override fun onPreviewLoadError(p0: java.lang.Exception?) { + override fun onPreviewLoadError(e: Exception?) { background = ColorDrawable(Color.TRANSPARENT) + beGone() } }) } } } + override fun onDestroyView() { + super.onDestroyView() + Glide.clear(view.photo_view) + } + fun rotateImageViewBy(degrees: Float) { - view.subsampling_view.visibility = View.GONE + view.subsampling_view.beGone() loadBitmap(degrees) }