pull/84/head
kunfei 5 years ago
parent 6422bd511c
commit 662b7df35b
  1. 12
      app/src/main/java/io/legado/app/help/ImageLoader.kt

@ -12,13 +12,15 @@ import java.io.File
object ImageLoader { object ImageLoader {
fun load(context: Context, path: String?): RequestBuilder<Drawable> { fun load(context: Context, path: String?): RequestBuilder<Drawable> {
if (path?.startsWith("http", true) == true) { return when {
return Glide.with(context).load(path) path.isNullOrEmpty() -> Glide.with(context).load(path)
path.startsWith("http", true) -> Glide.with(context).load(path)
else -> try {
Glide.with(context).load(File(path))
} catch (e: Exception) {
Glide.with(context).load(path)
} }
kotlin.runCatching {
return Glide.with(context).load(File(path))
} }
return Glide.with(context).load(path)
} }
fun load(context: Context, @DrawableRes resId: Int?): RequestBuilder<Drawable> { fun load(context: Context, @DrawableRes resId: Int?): RequestBuilder<Drawable> {

Loading…
Cancel
Save