use glide rotate transformation only when needed

This commit is contained in:
tibbi 2017-09-14 15:40:33 +02:00
parent d03729fbf5
commit 0af594ee0b

View file

@ -28,9 +28,12 @@ class GlideDecoder : ImageDecoder {
.signature(uri.path.getFileSignature()) .signature(uri.path.getFileSignature())
.format(DecodeFormat.PREFER_ARGB_8888) .format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.transform(GlideRotateTransformation(context, getRotationDegrees(orientation)))
.override(targetWidth, targetHeight) .override(targetWidth, targetHeight)
val degrees = getRotationDegrees(orientation)
if (degrees != 0f)
options.transform(GlideRotateTransformation(context, getRotationDegrees(orientation)))
val drawable = Glide.with(context) val drawable = Glide.with(context)
.load(uri) .load(uri)
.apply(options) .apply(options)