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

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

Merge changes from topic "stl-element-with-values" into main

* changes:
  Use Element instead of Modifier.element() in QS
  Introduce ElementWithValues to make Element cheaper and simpler (1/3)
parents 93a226f2 67386121
Loading
Loading
Loading
Loading
+17 −21
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ constructor(
            key = if (isStart) StartButtonElementKey else EndButtonElementKey,
            modifier = modifier,
        ) {
            content {
            Shortcut(
                viewId = if (isStart) R.id.start_button else R.id.end_button,
                viewModel = if (isStart) viewModel.startButton else viewModel.endButton,
@@ -86,19 +85,16 @@ constructor(
            )
        }
    }
    }

    @Composable
    fun ContentScope.IndicationArea(modifier: Modifier = Modifier) {
        Element(key = IndicationAreaElementKey, modifier = modifier.indicationAreaPadding()) {
            content {
            IndicationArea(
                indicationAreaViewModel = indicationAreaViewModel,
                indicationController = indicationController,
            )
        }
    }
    }

    @Composable
    fun shortcutSizeDp(): DpSize {
+10 −14
Original line number Diff line number Diff line
@@ -26,11 +26,9 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.contains
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.ContentScope
import com.android.compose.modifiers.padding
@@ -132,7 +130,6 @@ constructor(
        }

        Element(key = largeClockElementKey, modifier = modifier) {
            content {
            ClockView(
                checkNotNull(currentClock).largeClock.view,
                modifier =
@@ -145,7 +142,6 @@ constructor(
            )
        }
    }
    }

    fun getClockCenteringDistance(): Float {
        return Resources.getSystem().displayMetrics.widthPixels / 4f
+50 −53
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ constructor(
        val resources = LocalContext.current.resources

        Element(key = ClockElementKeys.smartspaceElementKey, modifier = modifier) {
            content {
            Column(
                modifier =
                    modifier
@@ -84,8 +83,7 @@ constructor(
                    return@Column
                }

                    val paddingBelowClockStart =
                        dimensionResource(R.dimen.below_clock_padding_start)
                val paddingBelowClockStart = dimensionResource(R.dimen.below_clock_padding_start)
                val paddingBelowClockEnd = dimensionResource(R.dimen.below_clock_padding_end)
                val paddingCardHorizontal = paddingBelowClockEnd

@@ -126,7 +124,6 @@ constructor(
            }
        }
    }
    }

    @Composable
    private fun Card(modifier: Modifier = Modifier) {
+4 −9
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
@@ -109,16 +108,12 @@ constructor(
        modifier: Modifier = Modifier,
    ) {
        Element(key = elementKey, modifier) {
            content {
            ClockView(
                    clock.largeClock.layout.views.firstOrNull {
                        it.id == weatherClockElementViewId
                    },
                clock.largeClock.layout.views.firstOrNull { it.id == weatherClockElementViewId },
                modifier,
            )
        }
    }
    }

    @Composable
    fun ContentScope.LargeClockSectionBelowSmartspace(
+3 −5
Original line number Diff line number Diff line
@@ -116,11 +116,9 @@ fun ContentScope.FooterActionsWithAnimatedVisibility(
        QuickSettingsTheme {
            // This view has its own horizontal padding
            // TODO(b/321716470) This should use a lifecycle tied to the scene.
            FooterActions(
                viewModel = viewModel,
                qsVisibilityLifecycleOwner = lifecycleOwner,
                modifier = Modifier.element(QuickSettings.Elements.FooterActions),
            )
            Element(QuickSettings.Elements.FooterActions, Modifier) {
                FooterActions(viewModel = viewModel, qsVisibilityLifecycleOwner = lifecycleOwner)
            }
        }
    }
}
Loading