Mercurial > dwindows
changeset 2691:e13607b87517
Android: Call notifyDataSetChanged() on ViewPager2 adapters to fix some
initial display issues on notebook widgets.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 31 Oct 2021 21:22:11 +0000 |
parents | 755d9ad07aaf |
children | 231f9489a38a |
files | android/DWindows.kt |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Sun Oct 31 12:59:45 2021 +0000 +++ b/android/DWindows.kt Sun Oct 31 21:22:11 2021 +0000 @@ -1186,6 +1186,7 @@ supportActionBar?.hide() } } + adapter.notifyDataSetChanged() } } return window @@ -1546,6 +1547,7 @@ } else { window.visibility = View.VISIBLE } + adapter.notifyDataSetChanged() windowSwitchWindow(index) } } @@ -1581,6 +1583,8 @@ windowStyles.removeAt(index) windowDefault.removeAt(index) + adapter.notifyDataSetChanged() + retval = 0 // DW_ERROR_NONE } else { // If we are removing an individual widget, @@ -2292,6 +2296,7 @@ adapter.pageList.add(pageID) tabs.addTab(tab) } + adapter.notifyDataSetChanged() } } return pageID @@ -2334,6 +2339,7 @@ adapter.viewList.removeAt(index) adapter.pageList.removeAt(index) tabs.removeTab(tab) + adapter.notifyDataSetChanged() } } } @@ -2392,6 +2398,7 @@ ) adapter.viewList[index] = box + adapter.notifyDataSetChanged() } } } @@ -2437,9 +2444,11 @@ if (pager != null && tabs != null) { val adapter: DWTabViewPagerAdapter = pager.adapter as DWTabViewPagerAdapter val index = adapter.pageList.indexOf(pageID) - val tab = tabs.getTabAt(index) - - tabs.selectTab(tab) + + if (index > -1 && index < adapter.pageList.count()) { + tabs.setScrollPosition(index, 0F, true) + pager.setCurrentItem(index, true) + } } } }