Decode the title of sources containing special html characters (#326)
#325
This commit is contained in:
parent
db124ab9de
commit
6fa8c901fc
@ -604,7 +604,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
||||
} else {
|
||||
for (tag in maybeSources) {
|
||||
val item = PrimaryDrawerItem()
|
||||
.withName(tag.title)
|
||||
.withName(tag.getTitleDecoded())
|
||||
.withIdentifier(tag.id.toLong())
|
||||
.withOnDrawerItemClickListener { _, _, _ ->
|
||||
allItems = ArrayList()
|
||||
|
@ -90,13 +90,13 @@ class ItemCardAdapter(
|
||||
}
|
||||
|
||||
if (itm.getIcon(c).isEmpty()) {
|
||||
val color = generator.getColor(itm.sourcetitle)
|
||||
val color = generator.getColor(itm.getSourceTitle())
|
||||
|
||||
val drawable =
|
||||
TextDrawable
|
||||
.builder()
|
||||
.round()
|
||||
.build(itm.sourcetitle.toTextDrawableString(c), color)
|
||||
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
||||
holder.mView.sourceImage.setImageDrawable(drawable)
|
||||
} else {
|
||||
c.circularBitmapDrawable(config, itm.getIcon(c), holder.mView.sourceImage)
|
||||
|
@ -81,13 +81,13 @@ class ItemListAdapter(
|
||||
if (itm.getThumbnail(c).isEmpty()) {
|
||||
|
||||
if (itm.getIcon(c).isEmpty()) {
|
||||
val color = generator.getColor(itm.sourcetitle)
|
||||
val color = generator.getColor(itm.getSourceTitle())
|
||||
|
||||
val drawable =
|
||||
TextDrawable
|
||||
.builder()
|
||||
.round()
|
||||
.build(itm.sourcetitle.toTextDrawableString(c), color)
|
||||
.build(itm.getSourceTitle().toTextDrawableString(c), color)
|
||||
|
||||
holder.mView.itemImage.setImageDrawable(drawable)
|
||||
} else {
|
||||
|
@ -46,19 +46,19 @@ class SourcesListAdapter(
|
||||
config = Config(c)
|
||||
|
||||
if (itm.getIcon(c).isEmpty()) {
|
||||
val color = generator.getColor(itm.title)
|
||||
val color = generator.getColor(itm.getTitleDecoded())
|
||||
|
||||
val drawable =
|
||||
TextDrawable
|
||||
.builder()
|
||||
.round()
|
||||
.build(itm.title.toTextDrawableString(c), color)
|
||||
.build(itm.getTitleDecoded().toTextDrawableString(c), color)
|
||||
holder.mView.itemImage.setImageDrawable(drawable)
|
||||
} else {
|
||||
c.circularBitmapDrawable(config, itm.getIcon(c), holder.mView.itemImage)
|
||||
}
|
||||
|
||||
holder.mView.sourceTitle.text = itm.title
|
||||
holder.mView.sourceTitle.text = itm.getTitleDecoded()
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
@ -64,6 +64,10 @@ data class Source(
|
||||
}
|
||||
return constructUrl(config, "favicons", icon)
|
||||
}
|
||||
|
||||
fun getTitleDecoded(): String {
|
||||
return Html.fromHtml(title).toString()
|
||||
}
|
||||
}
|
||||
|
||||
data class Item(
|
||||
@ -167,6 +171,10 @@ data class Item(
|
||||
return Html.fromHtml(title).toString()
|
||||
}
|
||||
|
||||
fun getSourceTitle(): String {
|
||||
return Html.fromHtml(sourcetitle).toString()
|
||||
}
|
||||
|
||||
// TODO: maybe find a better way to handle these kind of urls
|
||||
fun getLinkDecoded(): String {
|
||||
var stringUrl: String
|
||||
|
@ -32,7 +32,7 @@ fun Item.sourceAndDateText(): String {
|
||||
""
|
||||
}
|
||||
|
||||
return this.sourcetitle + formattedDate
|
||||
return this.getSourceTitle() + formattedDate
|
||||
}
|
||||
|
||||
fun Item.toggleStar(): Item {
|
||||
|
@ -28,7 +28,7 @@ fun SourceEntity.toView(): Source =
|
||||
fun Source.toEntity(): SourceEntity =
|
||||
SourceEntity(
|
||||
this.id,
|
||||
this.title,
|
||||
this.getTitleDecoded(),
|
||||
this.tags.tags,
|
||||
this.spout,
|
||||
this.error,
|
||||
@ -68,6 +68,6 @@ fun Item.toEntity(): ItemEntity =
|
||||
this.thumbnail,
|
||||
this.icon,
|
||||
this.link,
|
||||
this.sourcetitle,
|
||||
this.getSourceTitle(),
|
||||
this.tags.tags
|
||||
)
|
Loading…
Reference in New Issue
Block a user