feat: 优化

pull/219/head
kunfei 5 years ago
parent 606324e943
commit 5ca20e06cf
  1. 3
      app/src/main/java/io/legado/app/help/ImageLoader.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt

@ -13,6 +13,9 @@ import java.io.File
object ImageLoader { object ImageLoader {
/**
* 自动判断path类型
*/
fun load(context: Context, path: String?): RequestBuilder<Drawable> { fun load(context: Context, path: String?): RequestBuilder<Drawable> {
return when { return when {
path.isNullOrEmpty() -> Glide.with(context).load(path) path.isNullOrEmpty() -> Glide.with(context).load(path)

@ -130,7 +130,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
fun load(path: String?, name: String?, author: String?) { fun load(path: String?, name: String?, author: String?) {
setText(name, author) setText(name, author)
ImageLoader.load(context, path)//Glide自动识别http://和file:// ImageLoader.load(context, path)//Glide自动识别http://,content://和file://
.placeholder(R.drawable.image_cover_default) .placeholder(R.drawable.image_cover_default)
.error(R.drawable.image_cover_default) .error(R.drawable.image_cover_default)
.listener(object : RequestListener<Drawable> { .listener(object : RequestListener<Drawable> {

Loading…
Cancel
Save