Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4259f457 authored by LuK1337's avatar LuK1337 Committed by Luca Stefani
Browse files

SystemUI: Avoid adding useless empty quick settings page

* Previously the code would work this way:
  if nTiles == nPages * nRows * nCols we aren't
  adding additional page but otherwise we add a
  single empty page.
* Now that I'm basically always rounding
  nTiles / (nPages * nRows * nCols) the numPages
  variable is initialized to proper value.

Change-Id: Ie352f51d985f3ed97dc645bc18645894201998ff
parent 7aa0df5b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -245,10 +245,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
    private void emptyAndInflateOrRemovePages() {
        final int nTiles = mTiles.size();
        // We should always have at least one page, even if it's empty.
        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);
        int numPages = Math.max((int) Math.ceil((double) nTiles / mPages.get(0).maxTiles()), 1);

        final int NP = mPages.size();
        for (int i = 0; i < NP; i++) {