pull/48/head
kunfei 5 years ago
parent c08a32868c
commit 50f698c1c3
  1. 4
      app/src/main/java/io/legado/app/service/AudioPlayService.kt
  2. 29
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesAdapter.kt

@ -215,7 +215,11 @@ class AudioPlayService : BaseService(),
upNotification() upNotification()
} }
/**
* 更新播放进度
*/
private fun upPlayProgress() { private fun upPlayProgress() {
saveProgress()
postEvent(Bus.AUDIO_PROGRESS, mediaPlayer.currentPosition) postEvent(Bus.AUDIO_PROGRESS, mediaPlayer.currentPosition)
handler.postDelayed(mpRunnable, 1000) handler.postDelayed(mpRunnable, 1000)
} }

@ -1,6 +1,11 @@
package io.legado.app.ui.rss.article package io.legado.app.ui.rss.article
import android.content.Context 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.R
import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.base.adapter.SimpleRecyclerAdapter import io.legado.app.base.adapter.SimpleRecyclerAdapter
@ -26,8 +31,30 @@ class RssArticlesAdapter(context: Context, val callBack: CallBack) :
if (item.image.isNullOrBlank()) { if (item.image.isNullOrBlank()) {
image_view.gone() image_view.gone()
} else { } else {
image_view.visible()
ImageLoader.load(context, item.image) ImageLoader.load(context, item.image)
.addListener(object : RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
image_view.gone()
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
image_view.visible()
return false
}
})
.into(image_view) .into(image_view)
} }
if (item.read) { if (item.read) {

Loading…
Cancel
Save