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 6ee6bb8002..f9bcd26833 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayViewHolder.kt @@ -13,6 +13,7 @@ import androidx.annotation.VisibleForTesting import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.widget.AppCompatImageButton import androidx.core.content.ContextCompat +import kotlinx.android.synthetic.main.tab_tray_grid_item.view.* import mozilla.components.browser.state.state.MediaState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.browser.tabstray.TabViewHolder @@ -79,7 +80,7 @@ class TabTrayViewHolder( updateUrl(tab) updateFavicon(tab) updateCloseButtonDescription(tab.title) - updateBackgroundColor(isSelected) + updateSelectedTabIndicator(isSelected) if (tab.thumbnail != null) { thumbnailView.setImageBitmap(tab.thumbnail) @@ -170,9 +171,13 @@ class TabTrayViewHolder( } @VisibleForTesting - internal fun updateBackgroundColor(isSelected: Boolean) { + internal fun updateSelectedTabIndicator(isSelected: Boolean) { if (itemView.context.settings().gridTabView) { - // No need to set a background color in the item view for grid tabs. + itemView.tab_tray_grid_item.background = if (isSelected) { + AppCompatResources.getDrawable(itemView.context, R.drawable.tab_tray_grid_item_selected_border) + } else { + null + } return } diff --git a/app/src/main/res/drawable/tab_tray_grid_item_selected_border.xml b/app/src/main/res/drawable/tab_tray_grid_item_selected_border.xml new file mode 100644 index 0000000000..b2165f78e1 --- /dev/null +++ b/app/src/main/res/drawable/tab_tray_grid_item_selected_border.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/tab_tray_grid_item.xml b/app/src/main/res/layout/tab_tray_grid_item.xml index 7ead6c8912..6dc1f3ba23 100644 --- a/app/src/main/res/layout/tab_tray_grid_item.xml +++ b/app/src/main/res/layout/tab_tray_grid_item.xml @@ -13,6 +13,7 @@ A FrameLayout here is an efficient way of having a views stack while allowing: xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/tab_tray_grid_item" android:layout_width="match_parent" android:layout_height="202dp" android:clipChildren="false"