ThemeConfig.kt: Set getBgImage return type as Bitmap?

Signed-off-by: 1552980358 <1552980358@qq.com>
pull/1209/head
1552980358 3 years ago
parent 8907cec1d3
commit ccb3135055
  1. 8
      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() {

Loading…
Cancel
Save