File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
src/main/java/com/duckduckgo/app/tabs/ui Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -384,19 +384,22 @@ class TabSwitcherActivity :
384384 lifecycleScope.launch {
385385 viewModel.viewState.flowWithLifecycle(lifecycle).collectLatest {
386386 tabsRecycler.invalidateItemDecorations()
387- tabsAdapter.updateData(it.tabSwitcherItems)
387+
388+ val shouldScroll = firstTimeLoadingTabsList && it.tabs.isNotEmpty()
389+
390+ tabsAdapter.updateData(it.tabSwitcherItems) {
391+ if (shouldScroll) {
392+ firstTimeLoadingTabsList = false
393+ scrollToActiveTab()
394+ }
395+ }
388396
389397 updateToolbarTitle(it.mode, it.tabs.size)
390398 updateTabGridItemDecorator()
391399
392400 tabTouchHelper.mode = it.mode
393401
394402 invalidateOptionsMenu()
395-
396- if (firstTimeLoadingTabsList && it.tabs.isNotEmpty()) {
397- firstTimeLoadingTabsList = false
398- scrollToActiveTab()
399- }
400403 }
401404 }
402405
Original file line number Diff line number Diff line change @@ -467,8 +467,8 @@ class TabSwitcherAdapter(
467467 }
468468 }
469469
470- fun updateData (updatedList : List <TabSwitcherItem >) {
471- differ.submitList(updatedList)
470+ fun updateData (updatedList : List <TabSwitcherItem >, onDataUpdated : Runnable ? = null ) {
471+ differ.submitList(updatedList, onDataUpdated )
472472 }
473473
474474 fun getTabSwitcherItem (position : Int ): TabSwitcherItem ? = differ.currentList.getOrNull(position)
Original file line number Diff line number Diff line change 1- VERSION =5.270.1
1+ VERSION =5.270.2
You can’t perform that action at this time.
0 commit comments