|
|
|
@ -1,17 +1,20 @@ |
|
|
|
|
package io.legado.app.ui.rss.article |
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
|
|
import android.content.Context |
|
|
|
|
import android.graphics.drawable.Drawable |
|
|
|
|
import android.view.ViewGroup |
|
|
|
|
import com.bumptech.glide.load.DataSource |
|
|
|
|
import com.bumptech.glide.load.engine.GlideException |
|
|
|
|
import com.bumptech.glide.request.RequestListener |
|
|
|
|
import com.bumptech.glide.request.RequestOptions |
|
|
|
|
import com.bumptech.glide.request.target.Target |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
|
import io.legado.app.data.entities.RssArticle |
|
|
|
|
import io.legado.app.databinding.ItemRssArticle1Binding |
|
|
|
|
import io.legado.app.help.glide.ImageLoader |
|
|
|
|
import io.legado.app.help.glide.OkHttpModelLoader |
|
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
|
import io.legado.app.utils.gone |
|
|
|
|
import io.legado.app.utils.visible |
|
|
|
@ -24,6 +27,7 @@ class RssArticlesAdapter1(context: Context, callBack: CallBack) : |
|
|
|
|
return ItemRssArticle1Binding.inflate(inflater, parent, false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("CheckResult") |
|
|
|
|
override fun convert( |
|
|
|
|
holder: ItemViewHolder, |
|
|
|
|
binding: ItemRssArticle1Binding, |
|
|
|
@ -36,7 +40,9 @@ class RssArticlesAdapter1(context: Context, callBack: CallBack) : |
|
|
|
|
if (item.image.isNullOrBlank() && !callBack.isGridLayout) { |
|
|
|
|
imageView.gone() |
|
|
|
|
} else { |
|
|
|
|
ImageLoader.load(context, item.image, item.origin).apply { |
|
|
|
|
val options = |
|
|
|
|
RequestOptions().set(OkHttpModelLoader.sourceOriginOption, item.origin) |
|
|
|
|
ImageLoader.load(context, item.image).apply(options).apply { |
|
|
|
|
if (callBack.isGridLayout) { |
|
|
|
|
placeholder(R.drawable.image_rss_article) |
|
|
|
|
} else { |
|
|
|
|