For #14619: Show half a tab top offset when scrolling to selected tab.

upstream-sync
mcarare 4 years ago committed by Mihai Adrian Carare
parent 20df97ad57
commit 1a10215caf

@ -652,13 +652,15 @@ class TabTrayView(
// We offset the tab index by the number of items in the other adapters.
// We add the offset, because the layoutManager is initialized with `reverseLayout`.
// We also add 1 to display the tab item above the selected browser tab.
val recyclerViewIndex = selectedBrowserTabIndex +
collectionsButtonAdapter.itemCount +
syncedTabsController.adapter.itemCount +
1
syncedTabsController.adapter.itemCount
layoutManager?.scrollToPosition(recyclerViewIndex)
smoothScrollBy(
0,
- resources.getDimensionPixelSize(R.dimen.tab_tray_tab_item_height) / 2
)
}
}

@ -7,7 +7,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tab_item"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_height="@dimen/tab_tray_tab_item_height"
android:clickable="true"
android:focusable="true"
android:foreground="?android:selectableItemBackground">

@ -171,6 +171,7 @@
<!-- Tabs Tray -->
<dimen name="tab_tray_top_offset">40dp</dimen>
<dimen name="tab_tray_tab_item_height">88dp</dimen>
<dimen name="tab_tray_list_item_thumbnail_width">92dp</dimen>
<dimen name="tab_tray_list_item_thumbnail_height">72dp</dimen>
<dimen name="tab_tray_grid_item_thumbnail_width">156dp</dimen>

Loading…
Cancel
Save