Fixed: D&D description is not displayed correctly.

* The issue was caused by an HTML entity in the description of the "D&D" ZIM file. The description was displayed as "D&D Wiki" because it was not properly decoded before being set in the TextView.
* We have now implemented proper decoding of any HTML entities present in the title or description before setting them to the TextView, ensuring the description is displayed correctly.
This commit is contained in:
MohitMaliFtechiz 2024-11-27 16:43:08 +05:30 committed by MohitMaliFtechiz
parent 2cd2e15365
commit 99feed5bb8
2 changed files with 5 additions and 4 deletions

View File

@ -103,8 +103,8 @@ sealed class LibraryViewHolder<in T : LibraryListItem>(containerView: View) :
@Suppress("MagicNumber")
override fun bind(item: LibraryDownloadItem) {
itemDownloadBinding.libraryDownloadFavicon.setBitmap(item.favIcon)
itemDownloadBinding.libraryDownloadTitle.text = item.title
itemDownloadBinding.libraryDownloadDescription.text = item.description
itemDownloadBinding.libraryDownloadTitle.setTextAndVisibility(item.title)
itemDownloadBinding.libraryDownloadDescription.setTextAndVisibility(item.description)
itemDownloadBinding.downloadProgress.progress = item.progress
itemDownloadBinding.stop.apply {
setToolTipWithContentDescription(itemDownloadBinding.root.context.getString(string.stop))

View File

@ -20,10 +20,11 @@ package org.kiwix.kiwixmobile.core.extensions
import android.view.View
import android.widget.TextView
import org.kiwix.kiwixmobile.core.utils.StyleUtils.fromHtml
fun TextView.setTextAndVisibility(nullableText: String?) =
if (nullableText != null && nullableText.isNotEmpty()) {
text = nullableText
if (!nullableText.isNullOrEmpty()) {
text = nullableText.fromHtml().toString()
visibility = View.VISIBLE
} else {
visibility = View.GONE