From 3f06512066df8ec67ccd19da8da81b0bc71cfb92 Mon Sep 17 00:00:00 2001 From: errnull Date: Mon, 17 Jun 2019 14:25:00 +0800 Subject: [PATCH] fix: reset image when bitmap matte layer. --- .../com/opensource/svgaplayer/SVGAVideoEntity.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt index 6f4a97c2..17f7f1d6 100644 --- a/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt +++ b/library/src/main/java/com/opensource/svgaplayer/SVGAVideoEntity.kt @@ -94,9 +94,16 @@ class SVGAVideoEntity { if (bitmap != null) { images.put(imageKey, bitmap) } else { - (cacheDir.absolutePath + "/" + imageKey + ".png").takeIf { File(it).exists() }?.let { - BitmapFactory.decodeFile(it, options)?.let { - images.put(imageKey, it) + // bitmap.matte : bitmap + var filePath = cacheDir.absolutePath + "/" + imgObjects[imageKey] + ".png" + var bitmap = if (File(filePath).exists()) BitmapFactory.decodeFile(filePath, options) else null + if (bitmap != null) { + images.put(imageKey, bitmap) + } else { + (cacheDir.absolutePath + "/" + imageKey + ".png").takeIf { File(it).exists() }?.let { + BitmapFactory.decodeFile(it, options)?.let { + images.put(imageKey, it) + } } } }