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

Commit 8897a42b authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Coerce the width in boucneable layout to a min of 0

Test: abtd runs with and without cl and flag
Bug: 438943936
Flag: com.android.systemui.qs_edit_mode_v2
Change-Id: I8cda6de36b0dd1bb12c429e50ccef3b411a7d90e
parent 0105770f
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -97,8 +97,6 @@ private fun <T> ContentScope.ButtonGroupRow(
        @Composable
        ContentScope.(tile: SizedTile<T>, interactionSource: MutableInteractionSource) -> Unit,
) {
    val halfPadding = horizontalPadding / 2

    // Avoid setting the horizontal padding with the ButtonGroup to ensure that weight distribution
    // works properly for all rows.
    ButtonGroup(
@@ -108,8 +106,6 @@ private fun <T> ContentScope.ButtonGroupRow(
    ) {
        for ((indexInRow, sizedTile) in row.withIndex()) {
            val column = row.subList(0, indexInRow).fastSumBy { it.width }
            val onLastColumn = column == columns - sizedTile.width
            val isFirst = indexInRow == 0
            customItem(
                buttonGroupContent = {
                    key(keys(sizedTile.tile)) {
@@ -188,7 +184,7 @@ private fun Modifier.rowPadding(
        val startPadding = startCol * horizontalPadding.roundToPx() / columns
        val endPadding = (columns - endCol) * horizontalPaddingPx / columns

        val width = constraints.maxWidth - startPadding - endPadding
        val width = (constraints.maxWidth - startPadding - endPadding).coerceAtLeast(0)
        val placeable = measurable.measure(constraints.copy(minWidth = width, maxWidth = width))
        layout(constraints.maxWidth, placeable.height) { placeable.place(startPadding, 0) }
    }