Relocate the ActionList when in landscape mode.
Bug: 425470976
Flag: com.android.systemui.enable_underlay
Test: Manual test
Change-Id: Ie2df647170b52c2ab7427840c0ce393dd1ef1ba4
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt b/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt
index 1608d2c..7899014 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt
@@ -95,7 +95,6 @@
val minOverscrollDelta = (-8).dp
val maxOverscrollDelta = 0.dp
val columnSpacing = 8.dp
- val topPadding = 32.dp
val minGradientHeight = 70.dp
val edgeAligned = horizontalAlignment == Alignment.Start || horizontalAlignment == Alignment.End
val smartScrimAlpha by
@@ -283,7 +282,6 @@
)
}
}
- .padding(top = topPadding)
.padding(padding),
verticalArrangement = Arrangement.spacedBy(columnSpacing, Alignment.Bottom),
horizontalAlignment = horizontalAlignment,
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt
index 9c6599c..272603a 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt
@@ -33,6 +33,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
+import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.boundsInParent
import androidx.compose.ui.layout.onGloballyPositioned
@@ -123,6 +124,7 @@
val density = LocalDensity.current
val portrait = configuration.orientation == Configuration.ORIENTATION_PORTRAIT
var pillCenter by remember { mutableStateOf(Offset.Zero) }
+ var pillSize by remember { mutableStateOf(Size(0)) }
val screenWidthPx = with(density) { configuration.screenWidthDp.dp.toPx() }
var touchableRegion by remember { mutableStateOf<Rect?>(null) }
LaunchedEffect(expanded, touchableRegion) {
@@ -137,15 +139,25 @@
showEducation = viewModel.showLongPressEducation,
modifier =
modifier.graphicsLayer {
- translationX = screenWidthPx - size.width
- translationY = pillCenter.y - size.height
+ if (portrait) {
+ translationX = screenWidthPx - size.width
+ translationY = pillCenter.y - size.height
+ } else {
+ translationX = screenWidthPx - pillSize.height - size.width
+ translationY = pillCenter.y - pillSize.width
+ }
},
padding =
- PaddingValues(
- start = ACTIONS_HORIZONTAL_PADDING.dp,
- end = ACTIONS_HORIZONTAL_PADDING.dp,
- bottom = SHORT_PILL_ACTIONS_VERTICAL_PADDING.dp,
- ),
+ if (portrait) {
+ PaddingValues(
+ start = ACTIONS_HORIZONTAL_PADDING.dp,
+ end = ACTIONS_HORIZONTAL_PADDING.dp,
+ top = ACTIONS_TOP_PADDING.dp,
+ bottom = SHORT_PILL_ACTIONS_VERTICAL_PADDING.dp,
+ )
+ } else {
+ PaddingValues()
+ },
)
ShortPill(
actions = actions,
@@ -161,6 +173,7 @@
Modifier.graphicsLayer {
translationX = pillCenter.x - size.width / 2
translationY = pillCenter.y - size.height / 2
+ pillSize = size
}
.onGloballyPositioned { layoutCoordinates ->
layoutCoordinates.parentCoordinates?.let { parentCoordinates ->
@@ -211,6 +224,7 @@
modifier = modifier,
padding =
PaddingValues(
+ top = ACTIONS_TOP_PADDING.dp,
bottom = NAV_BAR_ACTIONS_PADDING.dp,
start = ACTIONS_HORIZONTAL_PADDING.dp,
end = ACTIONS_HORIZONTAL_PADDING.dp,
@@ -246,5 +260,6 @@
private const val SHORT_PILL_ACTIONS_VERTICAL_PADDING = 38
private const val NAV_BAR_ACTIONS_PADDING = NAV_BAR_HEIGHT_DP + 16
private const val ACTIONS_HORIZONTAL_PADDING = 32
+private const val ACTIONS_TOP_PADDING = 32
private const val ONE_TAP_DELAY_MS = 500L