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
1 changed files with 4 additions and 1 deletions

View File

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