do not attempt transforming the fullscreen image if rotation is 0 degrees

This commit is contained in:
tibbi 2017-03-23 18:27:18 +01:00
parent 71051fe928
commit ac63a8648d
1 changed files with 18 additions and 8 deletions

View File

@ -135,14 +135,24 @@ class PhotoFragment : ViewPagerFragment() {
}
private fun loadBitmap(degrees: Float = 0f) {
Glide.with(this)
.load(medium.path)
.asBitmap()
.transform(GlideRotateTransformation(context, degrees))
.format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565)
.thumbnail(0.1f)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(view.photo_view)
if (degrees == 0f) {
Glide.with(this)
.load(medium.path)
.asBitmap()
.format(DecodeFormat.PREFER_ARGB_8888)
.thumbnail(0.1f)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(view.photo_view)
} else {
Glide.with(this)
.load(medium.path)
.asBitmap()
.transform(GlideRotateTransformation(context, degrees))
.format(DecodeFormat.PREFER_ARGB_8888)
.thumbnail(0.1f)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(view.photo_view)
}
}
fun rotateImageViewBy(degrees: Float) {