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

Commit 332f187a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove charging status on hub v2" into main

parents e9fb33f3 0b368d76
Loading
Loading
Loading
Loading
+23 −17
Original line number Original line Diff line number Diff line
@@ -71,7 +71,7 @@ constructor(


    @Composable
    @Composable
    fun ContentScope.Content(modifier: Modifier = Modifier) {
    fun ContentScope.Content(modifier: Modifier = Modifier) {
        val showLockIcon = !communalSettingsInteractor.isV2FlagEnabled()
        val showLockIconAndChargingStatus = !communalSettingsInteractor.isV2FlagEnabled()


        CommunalTouchableSurface(viewModel = viewModel, modifier = modifier) {
        CommunalTouchableSurface(viewModel = viewModel, modifier = modifier) {
            val orientation = LocalConfiguration.current.orientation
            val orientation = LocalConfiguration.current.orientation
@@ -100,29 +100,33 @@ constructor(
                        )
                        )
                        with(hubOnboardingSection) { BottomSheet() }
                        with(hubOnboardingSection) { BottomSheet() }
                    }
                    }
                    if (showLockIcon) {
                    if (showLockIconAndChargingStatus) {
                        with(lockElement) {
                        with(lockElement) {
                            LockIcon(
                            LockIcon(
                                overrideColor = MaterialTheme.colorScheme.onPrimaryContainer,
                                overrideColor = MaterialTheme.colorScheme.onPrimaryContainer,
                                modifier = Modifier.element(Communal.Elements.LockIcon),
                                modifier = Modifier.element(Communal.Elements.LockIcon),
                            )
                            )
                        }
                        }
                    }

                        with(indicationAreaElement) {
                        with(indicationAreaElement) {
                            IndicationArea(
                            IndicationArea(
                                Modifier.element(Communal.Elements.IndicationArea)
                                Modifier.element(Communal.Elements.IndicationArea)
                                    .fillMaxWidth()
                                    .fillMaxWidth()
                                    .padding(
                                    .padding(
                                        bottom =
                                        bottom =
                                        dimensionResource(R.dimen.keyguard_indication_margin_bottom)
                                            dimensionResource(
                                                R.dimen.keyguard_indication_margin_bottom
                                            )
                                    )
                                    )
                            )
                            )
                        }
                        }
                    }
                },
                },
            ) { measurables, constraints ->
            ) { measurables, constraints ->
                val communalGridMeasurable = measurables[0]
                val communalGridMeasurable = measurables[0]
                val lockIconMeasurable = if (showLockIcon) measurables[1] else null
                val lockIconMeasurable = if (showLockIconAndChargingStatus) measurables[1] else null
                val bottomAreaMeasurable = measurables[if (showLockIcon) 2 else 1]
                val bottomAreaMeasurable =
                    if (showLockIconAndChargingStatus) measurables[2] else null


                val noMinConstraints = constraints.copy(minWidth = 0, minHeight = 0)
                val noMinConstraints = constraints.copy(minWidth = 0, minHeight = 0)


@@ -139,7 +143,7 @@ constructor(
                        )
                        )
                    }
                    }


                val bottomAreaPlaceable = bottomAreaMeasurable.measure(noMinConstraints)
                val bottomAreaPlaceable = bottomAreaMeasurable?.measure(noMinConstraints)


                val communalGridMaxHeight: Int
                val communalGridMaxHeight: Int
                val communalGridPositionY: Int
                val communalGridPositionY: Int
@@ -173,6 +177,7 @@ constructor(
                        lockIconPlaceable!!.place(x = lockIconBounds.left, y = lockIconBounds.top)
                        lockIconPlaceable!!.place(x = lockIconBounds.left, y = lockIconBounds.top)
                    }
                    }


                    if (bottomAreaPlaceable != null) {
                        val bottomAreaTop = constraints.maxHeight - bottomAreaPlaceable.height
                        val bottomAreaTop = constraints.maxHeight - bottomAreaPlaceable.height
                        bottomAreaPlaceable.place(x = 0, y = bottomAreaTop)
                        bottomAreaPlaceable.place(x = 0, y = bottomAreaTop)
                    }
                    }
@@ -180,3 +185,4 @@ constructor(
            }
            }
        }
        }
    }
    }
}