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

View file

@ -135,15 +135,25 @@ class PhotoFragment : ViewPagerFragment() {
} }
private fun loadBitmap(degrees: Float = 0f) { private fun loadBitmap(degrees: Float = 0f) {
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) Glide.with(this)
.load(medium.path) .load(medium.path)
.asBitmap() .asBitmap()
.transform(GlideRotateTransformation(context, degrees)) .transform(GlideRotateTransformation(context, degrees))
.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)
} }
}
fun rotateImageViewBy(degrees: Float) { fun rotateImageViewBy(degrees: Float) {
loadBitmap(degrees) loadBitmap(degrees)