use glide rotate transformation only when needed
This commit is contained in:
parent
d03729fbf5
commit
0af594ee0b
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue