mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Better handle saving animated drawables
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package eu.kanade.tachiyomi.util.system
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import coil.drawable.ScaleDrawable
|
||||
|
||||
fun Drawable.getBitmapOrNull(): Bitmap? = when (this) {
|
||||
is BitmapDrawable -> bitmap
|
||||
is ScaleDrawable -> child.toBitmap()
|
||||
else -> null
|
||||
}
|
||||
Reference in New Issue
Block a user