2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

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

This commit is contained in:
mcarare 2020-10-16 14:20:52 +03:00 committed by Mihai Adrian Carare
parent 20df97ad57
commit 1a10215caf
3 changed files with 7 additions and 4 deletions

View File

@ -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
)
}
}

View File

@ -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">

View File

@ -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>