From 0a0af212f07be515284ca2ba6ceb5afe67dae83e Mon Sep 17 00:00:00 2001 From: Jonathan Almeida Date: Fri, 6 Aug 2021 10:57:53 -0400 Subject: [PATCH] [fenix] Issue https://github.com/mozilla-mobile/fenix/issues/20718: Show url if title is missing for inactive tabs --- .../fenix/tabstray/browser/InactiveTabViewHolder.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/browser/InactiveTabViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabstray/browser/InactiveTabViewHolder.kt index 1323be2bbc..5726b3f34b 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/browser/InactiveTabViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/browser/InactiveTabViewHolder.kt @@ -61,9 +61,8 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite fun bind(tab: Tab) { val components = itemView.context.components - val makePrettyUrl: (String) -> String = { - it.toShortUrl(components.publicSuffixList).take(MAX_URI_LENGTH) - } + val title = tab.title.ifEmpty { tab.url.take(MAX_URI_LENGTH) } + val url = tab.url.toShortUrl(components.publicSuffixList).take(MAX_URI_LENGTH) itemView.setOnClickListener { browserTrayInteractor.open(tab) @@ -71,7 +70,7 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite binding.siteListItem.apply { components.core.icons.loadIntoView(iconView, tab.url) - setText(tab.title, makePrettyUrl(tab.url)) + setText(title, url) setSecondaryButton( R.drawable.mozac_ic_close, R.string.content_description_close_button