Fix number of pages in PagedTileLayout

If there's less that one full page of tiles, do not create an extra page
(as there's always a minimum of 1 page).

Fixes: 138625713
Test: manual with less and more than one page of tiles
Change-Id: I59a111f55ce3b00b94d8fb1a0594497c5a3af35c
This commit is contained in:
Fabian Kozynski
2019-07-31 14:41:18 -04:00
parent 2355b7f25d
commit 492be7ccee

View File

@@ -248,7 +248,9 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
int numPages = Math.max(nTiles / mPages.get(0).maxTiles(), 1);
// Add one more not full page if needed
numPages += (nTiles % mPages.get(0).maxTiles() == 0 ? 0 : 1);
if (nTiles > numPages * mPages.get(0).maxTiles()) {
numPages++;
}
final int NP = mPages.size();
for (int i = 0; i < NP; i++) {