From e6ba8339d1c242c8dc31efbb49d7a78d0ed822f0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 21 May 2020 10:30:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/rss/article/RssArticlesAdapter.kt | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt index 049239a7b..19fd6d0fb 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt @@ -30,35 +30,35 @@ class RssArticlesAdapter(context: Context, layoutId: Int, val callBack: CallBack if (item.image.isNullOrBlank() && !callBack.isGridLayout) { image_view.gone() } else { - val imageLoader = ImageLoader.load(context, item.image) - if (callBack.isGridLayout) { - imageLoader.placeholder(R.drawable.image_rss_article) - } else { - imageLoader.addListener(object : RequestListener { - override fun onLoadFailed( - e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean - ): Boolean { - image_view.gone() - return false - } + ImageLoader.load(context, item.image).apply { + if (callBack.isGridLayout) { + placeholder(R.drawable.image_rss_article) + } else { + addListener(object : RequestListener { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target?, + isFirstResource: Boolean + ): Boolean { + image_view.gone() + return false + } - override fun onResourceReady( - resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean - ): Boolean { - image_view.visible() - return false - } + override fun onResourceReady( + resource: Drawable?, + model: Any?, + target: Target?, + dataSource: DataSource?, + isFirstResource: Boolean + ): Boolean { + image_view.visible() + return false + } - }) - } - imageLoader.into(image_view) + }) + } + }.into(image_view) } if (item.read) { tv_title.textColorResource = R.color.tv_text_summary