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) { private fun loadBitmap(degrees: Float = 0f) {
Glide.with(this) if (degrees == 0f) {
.load(medium.path) Glide.with(this)
.asBitmap() .load(medium.path)
.transform(GlideRotateTransformation(context, degrees)) .asBitmap()
.format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565) .format(DecodeFormat.PREFER_ARGB_8888)
.thumbnail(0.1f) .thumbnail(0.1f)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.into(view.photo_view) .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) { fun rotateImageViewBy(degrees: Float) {