Mercurial > dwindows
comparison android/DWindows.kt @ 2682:856d3c8b559f
Android: Fix an exception when displaying a notebook with a placeholder.
Before a page is packed, I put in a placeholder... the placeholder needs to
be MATCH_PARENT to be in a ViewPager2.. create the placeholder MATCH_PARENT.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 25 Oct 2021 17:07:01 +0000 |
parents | c1482518b643 |
children | e7885fd45f7b |
comparison
equal
deleted
inserted
replaced
2681:c1482518b643 | 2682:856d3c8b559f |
---|---|
2170 do { | 2170 do { |
2171 adapter.currentPageID += 1 | 2171 adapter.currentPageID += 1 |
2172 } while (adapter.currentPageID == 0L || adapter.pageList.contains(adapter.currentPageID)) | 2172 } while (adapter.currentPageID == 0L || adapter.pageList.contains(adapter.currentPageID)) |
2173 pageID = adapter.currentPageID | 2173 pageID = adapter.currentPageID |
2174 // Temporarily add a black tab with an empty layout/box | 2174 // Temporarily add a black tab with an empty layout/box |
2175 val placeholder = LinearLayout(this) | |
2176 placeholder.layoutParams = LinearLayout.LayoutParams( | |
2177 LinearLayout.LayoutParams.MATCH_PARENT, | |
2178 LinearLayout.LayoutParams.MATCH_PARENT | |
2179 ) | |
2175 if (front != 0) { | 2180 if (front != 0) { |
2176 adapter.viewList.add(0, LinearLayout(this)) | 2181 adapter.viewList.add(0, placeholder) |
2177 adapter.pageList.add(0, pageID) | 2182 adapter.pageList.add(0, pageID) |
2178 tabs.addTab(tab, 0) | 2183 tabs.addTab(tab, 0) |
2179 } else { | 2184 } else { |
2180 adapter.viewList.add(LinearLayout(this)) | 2185 adapter.viewList.add(placeholder) |
2181 adapter.pageList.add(pageID) | 2186 adapter.pageList.add(pageID) |
2182 tabs.addTab(tab) | 2187 tabs.addTab(tab) |
2183 } | 2188 } |
2184 } | 2189 } |
2185 } | 2190 } |