kunfei 4 лет назад
Родитель
Сommit
f2edd4347b
1 измененных файлов с 7 добавлено и 13 удалено
  1. 7 13
      app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt

+ 7 - 13
app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt

@@ -570,20 +570,14 @@ object ReadBookConfig {
                 bgDrawable = when (curBgType()) {
                     0 -> ColorDrawable(Color.parseColor(curBgStr()))
                     1 -> {
-                        BitmapDrawable(
-                            resources,
-                            BitmapUtils.decodeAssetsBitmap(
-                                appCtx,
-                                "bg" + File.separator + curBgStr(),
-                                width,
-                                height
-                            )
-                        )
+                        val path = "bg" + File.separator + curBgStr()
+                        val bitmap = BitmapUtils.decodeAssetsBitmap(appCtx, path, width, height)
+                        BitmapDrawable(resources, bitmap)
+                    }
+                    else -> {
+                        val bitmap = BitmapUtils.decodeBitmap(curBgStr(), width, height)
+                        BitmapDrawable(resources, bitmap)
                     }
-                    else -> BitmapDrawable(
-                        resources,
-                        BitmapUtils.decodeBitmap(curBgStr(), width, height)
-                    )
                 }
             } catch (e: OutOfMemoryError) {
                 e.printOnDebug()