mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
use the built in glide function for rotating images
This commit is contained in:
parent
45a52997a1
commit
34028c9452
2 changed files with 6 additions and 24 deletions
|
@ -25,6 +25,7 @@ import com.bumptech.glide.load.DataSource
|
|||
import com.bumptech.glide.load.DecodeFormat
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.load.resource.bitmap.Rotate
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.request.target.Target
|
||||
|
@ -38,7 +39,10 @@ import com.simplemobiletools.gallery.pro.R
|
|||
import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity
|
||||
import com.simplemobiletools.gallery.pro.activities.PhotoActivity
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.helpers.*
|
||||
import com.simplemobiletools.gallery.pro.helpers.MEDIUM
|
||||
import com.simplemobiletools.gallery.pro.helpers.PATH
|
||||
import com.simplemobiletools.gallery.pro.helpers.PicassoDecoder
|
||||
import com.simplemobiletools.gallery.pro.helpers.PicassoRegionDecoder
|
||||
import com.simplemobiletools.gallery.pro.models.Medium
|
||||
import com.simplemobiletools.gallery.pro.svg.SvgSoftwareLayerSetter
|
||||
import com.squareup.picasso.Callback
|
||||
|
@ -360,7 +364,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
.fitCenter()
|
||||
|
||||
if (mCurrentRotationDegrees != 0) {
|
||||
options.transform(GlideRotateTransformation(mCurrentRotationDegrees))
|
||||
options.transform(Rotate(mCurrentRotationDegrees))
|
||||
options.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package com.simplemobiletools.gallery.pro.helpers
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Matrix
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||
import java.security.MessageDigest
|
||||
|
||||
class GlideRotateTransformation(val rotateRotationAngle: Int) : BitmapTransformation() {
|
||||
override fun transform(pool: BitmapPool, bitmap: Bitmap, outWidth: Int, outHeight: Int): Bitmap {
|
||||
if (rotateRotationAngle % 360 == 0) {
|
||||
return bitmap
|
||||
}
|
||||
|
||||
val matrix = Matrix()
|
||||
matrix.postRotate(rotateRotationAngle.toFloat())
|
||||
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true)
|
||||
}
|
||||
|
||||
override fun updateDiskCacheKey(messageDigest: MessageDigest) {
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue