Fix shortcuts icons size
parent
c77e023bef
commit
7b482e5bcf
@ -0,0 +1,24 @@
|
||||
package org.koitharu.kotatsu.core.ui.image
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.media.ThumbnailUtils
|
||||
import coil.size.Size
|
||||
import coil.size.pxOrElse
|
||||
import coil.transform.Transformation
|
||||
|
||||
class ThumbnailTransformation : Transformation {
|
||||
|
||||
override val cacheKey: String = javaClass.name
|
||||
|
||||
override suspend fun transform(input: Bitmap, size: Size): Bitmap {
|
||||
return ThumbnailUtils.extractThumbnail(
|
||||
input,
|
||||
size.width.pxOrElse { input.width },
|
||||
size.height.pxOrElse { input.height },
|
||||
)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?) = other is ThumbnailTransformation
|
||||
|
||||
override fun hashCode() = javaClass.hashCode()
|
||||
}
|
||||
Loading…
Reference in New Issue