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

Commit b8daba75 authored by Matt Pietal's avatar Matt Pietal
Browse files

Controls spacing

The last row may contain spacers, but these also need the correct
margins so all controls retain the same dimensions.

Fixes: 190089614
Test: manual (controls main activity + add/edit controls)
Change-Id: Ie19b98405213bc0f9ef53a11f44cb8013139e562
parent 97be3198
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -422,8 +422,12 @@ class ControlsUiControllerImpl @Inject constructor (
        // add spacers if necessary to keep control size consistent
        val mod = selectedStructure.controls.size % maxColumns
        var spacersToAdd = if (mod == 0) 0 else maxColumns - mod
        val margin = context.resources.getDimensionPixelSize(R.dimen.control_spacing)
        while (spacersToAdd > 0) {
            lastRow.addView(Space(context), LinearLayout.LayoutParams(0, 0, 1f))
            val lp = LinearLayout.LayoutParams(0, 0, 1f).apply {
                setMarginStart(margin)
            }
            lastRow.addView(Space(context), lp)
            spacersToAdd--
        }
    }