Compare commits

..

No commits in common. "f72ef2f5d4d03ee258f6f03a47f1cd141c028c5d" and "b9d69c3e646d8e5123823ef4ee7ea2f066b78c7f" have entirely different histories.

4 changed files with 26 additions and 12 deletions

View File

@ -145,8 +145,8 @@ dependencies {
implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1")
// glide
kapt("com.github.bumptech.glide:compiler:4.15.0")
implementation("com.github.bumptech.glide:okhttp3-integration:4.15.0")
kapt("com.github.bumptech.glide:compiler:4.14.2")
implementation("com.github.bumptech.glide:okhttp3-integration:4.14.2")
// Themes
implementation("com.github.rubensousa:floatingtoolbar:1.5.1")

View File

@ -20,8 +20,10 @@ import bou.amine.apps.readerforselfossv2.repository.Repository
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
import bou.amine.apps.readerforselfossv2.utils.getIcon
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.ViewTarget
import com.bumptech.glide.request.transition.Transition
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 com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.chip.Chip
import kotlinx.coroutines.CoroutineScope
@ -88,19 +90,31 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
Glide.with(context)
.load(source.getIcon(repository.baseUrl))
.into(object : ViewTarget<Chip?, Drawable?>(c) {
.listener(object : RequestListener<Drawable?> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable?>?,
isFirstResource: Boolean
): Boolean {
return false
}
override fun onResourceReady(
resource: Drawable,
transition: Transition<in Drawable?>?
) {
resource: Drawable?,
model: Any?,
target: Target<Drawable?>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
try {
c.chipIcon = resource
} catch (e: Exception) {
e.sendSilentlyWithAcraWithName("sources > onResourceReady")
}
return false
}
})
}).preload()
c.text = source.title.getHtmlDecoded()

View File

@ -76,7 +76,7 @@ class SelfossModel {
)
@Serializable
data class SourceParams(
val url: String? = null
val url: String?
)
@Serializable
data class Item(

View File

@ -20,7 +20,7 @@ fun SOURCE.toView(): SelfossModel.Source =
this.spout,
this.error,
this.icon,
if (this.url != null) SelfossModel.SourceParams(this.url) else null
SelfossModel.SourceParams(this.url)
)
fun SelfossModel.Source.toEntity(): SOURCE =