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

Commit dc295013 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Rework footer animation transition" into main

parents da37b50d 5fc51cc9
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.volume.panel.ui.composable

import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -56,17 +57,19 @@ fun VolumePanelComposeScope.HorizontalVolumePanelContent(
                    with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) }
                }
            }
            AnimatedContent(
                targetState = layout.footerComponents,
                label = "FooterComponentAnimation",
            ) { footerComponents ->
                Row(
                    modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement = Arrangement.spacedBy(spacing),
                ) {
                for (component in layout.footerComponents) {
                    AnimatedVisibility(
                        visible = component.isVisible,
                        modifier = Modifier.weight(1f),
                    ) {
                    for (component in footerComponents) {
                        if (component.isVisible) {
                            with(component.component as ComposeVolumePanelUiComponent) {
                            Content(Modifier)
                                Content(Modifier.weight(1f))
                            }
                        }
                    }
                }
+10 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.volume.panel.ui.composable

import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -50,26 +51,27 @@ fun VolumePanelComposeScope.VerticalVolumePanelContent(
                with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) }
            }
        }
        if (layout.footerComponents.isNotEmpty()) {

        AnimatedContent(
            targetState = layout.footerComponents,
            label = "FooterComponentAnimation",
        ) { footerComponents ->
            Row(
                modifier = Modifier.fillMaxWidth().wrapContentHeight(),
                horizontalArrangement = Arrangement.spacedBy(if (isLargeScreen) 28.dp else 20.dp),
            ) {
                val visibleComponentsCount =
                    layout.footerComponents.fastSumBy { if (it.isVisible) 1 else 0 }
                    footerComponents.fastSumBy { if (it.isVisible) 1 else 0 }

                // Center footer component if there is only one present
                if (visibleComponentsCount == 1) {
                    Spacer(modifier = Modifier.weight(0.5f))
                }

                for (component in layout.footerComponents) {
                    AnimatedVisibility(
                        visible = component.isVisible,
                        modifier = Modifier.weight(1f),
                    ) {
                for (component in footerComponents) {
                    if (component.isVisible) {
                        with(component.component as ComposeVolumePanelUiComponent) {
                            Content(Modifier)
                            Content(Modifier.weight(1f))
                        }
                    }
                }