From f05890efece82372f328182864a7095d464e7013 Mon Sep 17 00:00:00 2001 From: Jeff Boek Date: Fri, 29 May 2020 20:11:30 -0700 Subject: [PATCH] For #10848 - Fixes bug where selected index wouldnt be properly calculated in private mode --- .../main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt | 5 ++++- app/src/main/res/layout/component_tabstray.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt index e5421d512..4c048f2a2 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt @@ -49,6 +49,9 @@ class TabTrayViewHolder(itemView: View) : TabViewHolder(itemView) { * Displays the data of the given session and notifies the given observable about events. */ override fun bind(tab: Tab, isSelected: Boolean, observable: Observable) { + // This is a hack to workaround a bug in a-c. + // https://github.com/mozilla-mobile/android-components/issues/7186 + val isSelected2 = tab.id == itemView.context.components.core.store.state.selectedTabId this.tab = tab // Basic text @@ -57,7 +60,7 @@ class TabTrayViewHolder(itemView: View) : TabViewHolder(itemView) { updateCloseButtonDescription(tab.title) // Drawables and theme - updateBackgroundColor(isSelected) + updateBackgroundColor(isSelected2) thumbnailView.setImageBitmap(tab.thumbnail) iconView?.setImageBitmap(tab.icon) diff --git a/app/src/main/res/layout/component_tabstray.xml b/app/src/main/res/layout/component_tabstray.xml index fee2da4ad..9ea61030b 100644 --- a/app/src/main/res/layout/component_tabstray.xml +++ b/app/src/main/res/layout/component_tabstray.xml @@ -45,6 +45,7 @@ android:id="@+id/tab_layout" android:layout_width="0dp" android:layout_height="80dp" + android:background="@color/foundation_normal_theme" app:tabIndicatorColor="@color/accent_normal_theme" app:tabIconTint="@color/tab_icon" app:tabRippleColor="@android:color/transparent"