summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2020-04-09 11:13:07 -0700
committer Lucas Dupin <dupin@google.com> 2020-04-09 11:13:07 -0700
commit1ffaf8c28e4106b3113df16df811eec8c8df1fbc (patch)
tree3cd3b3520367f0a9d1549bccabf1fab83bbad33e
parent6f6216d303189f676176299d5aa843315709a4c6 (diff)
Fix calculation of empty spaces
We should not add spaces when columns are filled successfully. Bug: 152628601 Test: manual Change-Id: I2b86e440847e8de9ddabb43fca0d1f7083ffff12
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
index 02c6ff68450e..934a69508d68 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
@@ -429,7 +429,8 @@ class ControlsUiControllerImpl @Inject constructor (
}
// add spacers if necessary to keep control size consistent
- var spacersToAdd = maxColumns - (selectedStructure.controls.size % maxColumns)
+ val mod = selectedStructure.controls.size % maxColumns
+ var spacersToAdd = if (mod == 0) 0 else maxColumns - mod
while (spacersToAdd > 0) {
lastRow.addView(Space(context), LinearLayout.LayoutParams(0, 0, 1f))
spacersToAdd--