From 50f698c1c32387bdd5292feb52a5fe403d62f456 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 9 Nov 2019 16:28:12 +0800 Subject: [PATCH] up --- .../io/legado/app/service/AudioPlayService.kt | 4 +++ .../app/ui/rss/article/RssArticlesAdapter.kt | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 087f6d303..3b6fc33c3 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -215,7 +215,11 @@ class AudioPlayService : BaseService(), upNotification() } + /** + * 更新播放进度 + */ private fun upPlayProgress() { + saveProgress() postEvent(Bus.AUDIO_PROGRESS, mediaPlayer.currentPosition) handler.postDelayed(mpRunnable, 1000) } 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 4105e1958..1c6e144fd 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 @@ -1,6 +1,11 @@ package io.legado.app.ui.rss.article import android.content.Context +import android.graphics.drawable.Drawable +import com.bumptech.glide.load.DataSource +import com.bumptech.glide.load.engine.GlideException +import com.bumptech.glide.request.RequestListener +import com.bumptech.glide.request.target.Target import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter @@ -26,8 +31,30 @@ class RssArticlesAdapter(context: Context, val callBack: CallBack) : if (item.image.isNullOrBlank()) { image_view.gone() } else { - image_view.visible() ImageLoader.load(context, item.image) + .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 + } + + }) .into(image_view) } if (item.read) {