From 75f31d534e64fb699f96311ed141eb40e2aa2d3b Mon Sep 17 00:00:00 2001 From: Jonathan Almeida Date: Tue, 7 Feb 2023 23:38:31 -0500 Subject: [PATCH] [fenix] Bug 1815306 - Truncate tabs tray title to mitigate scroll performance We truncate the URL as well if we use that, but unlike the url TextView, we do not need to shorten it first. Co-authored-by: Matt Tighe Co-authored-by: Noah Bond --- .../fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt index e75a0d45eb..51bd1b8923 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt @@ -42,6 +42,7 @@ import org.mozilla.fenix.selection.SelectionHolder import org.mozilla.fenix.tabstray.TabsTrayInteractor import org.mozilla.fenix.tabstray.TabsTrayState import org.mozilla.fenix.tabstray.TabsTrayStore +import org.mozilla.fenix.tabstray.ext.toDisplayTitle /** * A RecyclerView ViewHolder implementation for "tab" items. @@ -128,9 +129,8 @@ abstract class AbstractBrowserTabViewHolder( } private fun updateTitle(tab: TabSessionState) { - val title = tab.content.title.ifEmpty { - tab.content.url - } + // We can use the max URI length for titles as well. + val title = tab.toDisplayTitle().take(MAX_URI_LENGTH) titleView.text = title }