2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-09 19:10:42 +00:00

For #3156 - If only one tab adding to collection make it selected (#3222)

This commit is contained in:
Emily Kager 2019-06-06 12:24:25 -07:00 committed by Colin Lee
parent c197d055b3
commit 4954aadd84

View File

@ -626,7 +626,7 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
ViewModelProviders.of(this).get(CreateCollectionViewModel::class.java) ViewModelProviders.of(this).get(CreateCollectionViewModel::class.java)
} }
viewModel?.tabs = tabs viewModel?.tabs = tabs
val selectedTabs = tabs.find { tab -> tab.sessionId == selectedTabId } val selectedTabs = tabs.find { tab -> tab.sessionId == selectedTabId } ?: if (tabs.size == 1) tabs[0] else null
val selectedSet = if (selectedTabs == null) mutableSetOf() else mutableSetOf(selectedTabs) val selectedSet = if (selectedTabs == null) mutableSetOf() else mutableSetOf(selectedTabs)
viewModel?.selectedTabs = selectedSet viewModel?.selectedTabs = selectedSet
viewModel?.tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections.reversed() viewModel?.tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections.reversed()