mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/11376 - Reverse tabs list order (https://github.com/mozilla-mobile/fenix/pull/16245)
This commit is contained in:
parent
73e14dd776
commit
63e2bd3f9e
@ -193,13 +193,11 @@ class TabTrayView(
|
|||||||
tabsAdapter.tabTrayInteractor = interactor
|
tabsAdapter.tabTrayInteractor = interactor
|
||||||
tabsAdapter.onTabsUpdated = {
|
tabsAdapter.onTabsUpdated = {
|
||||||
if (view.context.settings().gridTabView) {
|
if (view.context.settings().gridTabView) {
|
||||||
|
concatAdapter.addAdapter(syncedTabsController.adapter)
|
||||||
concatAdapter.addAdapter(collectionsButtonAdapter)
|
concatAdapter.addAdapter(collectionsButtonAdapter)
|
||||||
concatAdapter.addAdapter(syncedTabsController.adapter)
|
|
||||||
} else {
|
} else {
|
||||||
// Put the 'Add to collections' button after the tabs have loaded.
|
|
||||||
concatAdapter.addAdapter(0, collectionsButtonAdapter)
|
|
||||||
// Put the Synced Tabs adapter at the end.
|
|
||||||
concatAdapter.addAdapter(syncedTabsController.adapter)
|
concatAdapter.addAdapter(syncedTabsController.adapter)
|
||||||
|
concatAdapter.addAdapter(collectionsButtonAdapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAccessibilityEnabled) {
|
if (hasAccessibilityEnabled) {
|
||||||
@ -442,10 +440,7 @@ class TabTrayView(
|
|||||||
|
|
||||||
private fun setupListTabView() {
|
private fun setupListTabView() {
|
||||||
view.tabsTray.apply {
|
view.tabsTray.apply {
|
||||||
layoutManager = LinearLayoutManager(container.context).apply {
|
layoutManager = LinearLayoutManager(container.context)
|
||||||
reverseLayout = true
|
|
||||||
stackFromEnd = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -730,19 +725,11 @@ class TabTrayView(
|
|||||||
view.context.components.core.store.state.normalTabs
|
view.context.components.core.store.state.normalTabs
|
||||||
}
|
}
|
||||||
|
|
||||||
val selectedBrowserTabIndex = if (sessionId != null) {
|
return if (sessionId != null) {
|
||||||
tabs.indexOfFirst { it.id == sessionId }
|
tabs.indexOfFirst { it.id == sessionId }
|
||||||
} else {
|
} else {
|
||||||
tabs.indexOfFirst { it.id == view.context.components.core.store.state.selectedTabId }
|
tabs.indexOfFirst { it.id == view.context.components.core.store.state.selectedTabId }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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`.
|
|
||||||
return if (view.context.settings().listTabView) {
|
|
||||||
selectedBrowserTabIndex + collectionsButtonAdapter.itemCount + syncedTabsController.adapter.itemCount
|
|
||||||
} else {
|
|
||||||
selectedBrowserTabIndex
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
Loading…
Reference in New Issue
Block a user