From ccb31350559de1e4b1c45ec4556a054881e80bb9 Mon Sep 17 00:00:00 2001 From: 1552980358 <1552980358@qq.com> Date: Wed, 4 Aug 2021 17:07:44 +0800 Subject: [PATCH] ThemeConfig.kt: Set getBgImage return type as Bitmap? Signed-off-by: 1552980358 <1552980358@qq.com> --- app/src/main/java/io/legado/app/help/ThemeConfig.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ThemeConfig.kt b/app/src/main/java/io/legado/app/help/ThemeConfig.kt index bdbe9eb8d..39d33e02b 100644 --- a/app/src/main/java/io/legado/app/help/ThemeConfig.kt +++ b/app/src/main/java/io/legado/app/help/ThemeConfig.kt @@ -1,9 +1,9 @@ package io.legado.app.help import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory import android.graphics.Color -import android.graphics.drawable.BitmapDrawable -import android.graphics.drawable.Drawable import androidx.annotation.Keep import androidx.appcompat.app.AppCompatDelegate import io.legado.app.R @@ -43,14 +43,14 @@ object ThemeConfig { AppCompatDelegate.setDefaultNightMode(targetMode) } - fun getBgImage(context: Context): Drawable? { + fun getBgImage(context: Context): Bitmap? { val bgPath = when (Theme.getTheme()) { Theme.Light -> context.getPrefString(PreferKey.bgImage) Theme.Dark -> context.getPrefString(PreferKey.bgImageN) else -> null } if (bgPath.isNullOrBlank()) return null - return BitmapDrawable.createFromPath(bgPath) + return BitmapFactory.decodeFile(bgPath) } fun upConfig() {