Skip to content

Commit

Permalink
Fixed: D&D description is not displayed correctly.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
MohitMaliDeveloper committed Nov 27, 2024
1 parent 15081ca commit fd74f35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd74f35

Please sign in to comment.