Compare commits
2 Commits
b9d69c3e64
...
f72ef2f5d4
Author | SHA1 | Date | |
---|---|---|---|
|
f72ef2f5d4 | ||
|
f28cb759df |
@ -145,8 +145,8 @@ dependencies {
|
|||||||
implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1")
|
implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1")
|
||||||
|
|
||||||
// glide
|
// glide
|
||||||
kapt("com.github.bumptech.glide:compiler:4.14.2")
|
kapt("com.github.bumptech.glide:compiler:4.15.0")
|
||||||
implementation("com.github.bumptech.glide:okhttp3-integration:4.14.2")
|
implementation("com.github.bumptech.glide:okhttp3-integration:4.15.0")
|
||||||
|
|
||||||
// Themes
|
// Themes
|
||||||
implementation("com.github.rubensousa:floatingtoolbar:1.5.1")
|
implementation("com.github.rubensousa:floatingtoolbar:1.5.1")
|
||||||
|
@ -20,10 +20,8 @@ import bou.amine.apps.readerforselfossv2.repository.Repository
|
|||||||
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
|
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
|
||||||
import bou.amine.apps.readerforselfossv2.utils.getIcon
|
import bou.amine.apps.readerforselfossv2.utils.getIcon
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.DataSource
|
import com.bumptech.glide.request.target.ViewTarget
|
||||||
import com.bumptech.glide.load.engine.GlideException
|
import com.bumptech.glide.request.transition.Transition
|
||||||
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.bottomsheet.BottomSheetDialogFragment
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@ -90,31 +88,19 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
|
|||||||
|
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(source.getIcon(repository.baseUrl))
|
.load(source.getIcon(repository.baseUrl))
|
||||||
.listener(object : RequestListener<Drawable?> {
|
.into(object : ViewTarget<Chip?, Drawable?>(c) {
|
||||||
override fun onLoadFailed(
|
|
||||||
e: GlideException?,
|
|
||||||
model: Any?,
|
|
||||||
target: Target<Drawable?>?,
|
|
||||||
isFirstResource: Boolean
|
|
||||||
): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResourceReady(
|
override fun onResourceReady(
|
||||||
resource: Drawable?,
|
resource: Drawable,
|
||||||
model: Any?,
|
transition: Transition<in Drawable?>?
|
||||||
target: Target<Drawable?>?,
|
) {
|
||||||
dataSource: DataSource?,
|
|
||||||
isFirstResource: Boolean
|
|
||||||
): Boolean {
|
|
||||||
try {
|
try {
|
||||||
c.chipIcon = resource
|
c.chipIcon = resource
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.sendSilentlyWithAcraWithName("sources > onResourceReady")
|
e.sendSilentlyWithAcraWithName("sources > onResourceReady")
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}).preload()
|
|
||||||
|
})
|
||||||
|
|
||||||
c.text = source.title.getHtmlDecoded()
|
c.text = source.title.getHtmlDecoded()
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class SelfossModel {
|
|||||||
)
|
)
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SourceParams(
|
data class SourceParams(
|
||||||
val url: String?
|
val url: String? = null
|
||||||
)
|
)
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Item(
|
data class Item(
|
||||||
|
@ -20,7 +20,7 @@ fun SOURCE.toView(): SelfossModel.Source =
|
|||||||
this.spout,
|
this.spout,
|
||||||
this.error,
|
this.error,
|
||||||
this.icon,
|
this.icon,
|
||||||
SelfossModel.SourceParams(this.url)
|
if (this.url != null) SelfossModel.SourceParams(this.url) else null
|
||||||
)
|
)
|
||||||
|
|
||||||
fun SelfossModel.Source.toEntity(): SOURCE =
|
fun SelfossModel.Source.toEntity(): SOURCE =
|
||||||
|
Loading…
Reference in New Issue
Block a user