Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt +19 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.os.VibrationEffect.Composition.PRIMITIVE_LOW_TICK import android.os.VibrationEffect.Composition.PRIMITIVE_THUD import android.os.VibrationEffect.Composition.PRIMITIVE_TICK import android.os.Vibrator import android.view.Surface.ROTATION_270 import android.view.Surface.ROTATION_90 import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.Spring import androidx.compose.animation.core.animateFloatAsState Loading Loading @@ -92,6 +94,7 @@ fun ActionList( horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, portrait: Boolean = true, pillCenter: Offset = Offset.Zero, rotation: Int = 0, ) { val density = LocalDensity.current val minOverscrollDelta = (-8).dp Loading Loading @@ -344,13 +347,26 @@ fun ActionList( translationY = (1f - translation) * appxColumnY translationX = 0f } else { if (rotation == ROTATION_90) { translationY = (1f - translation) * (appxColumnY - pillCenter.y) translationX = (1f - translation) * chipWidthPx.toFloat() } else if (rotation == ROTATION_270) { translationY = (1f - translation) * (appxColumnY - pillCenter.y) translationX = (translation - 1f) * chipWidthPx.toFloat() } } scaleX = scale scaleY = scale transformOrigin = if (portrait) TransformOrigin(0.5f, 1f) else TransformOrigin(1f, 0f) if (portrait) { TransformOrigin(0.5f, 1f) } else { if (rotation == ROTATION_90) { TransformOrigin(1f, 0f) } else { TransformOrigin(0f, 0f) } } }, ) } Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt +22 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.ambientcue.ui.compose import android.content.res.Configuration import android.view.Surface.ROTATION_270 import android.view.Surface.ROTATION_90 import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues Loading @@ -38,6 +40,7 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.boundsInParent import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.toSize Loading Loading @@ -130,11 +133,15 @@ private fun TaskBarAnd3ButtonAmbientCue( LaunchedEffect(expanded, touchableRegion) { onShouldInterceptTouches(true, if (expanded) null else touchableRegion) } val content = LocalContext.current val rotation = content.display.rotation ActionList( actions = actions, visible = visible, expanded = expanded, horizontalAlignment = Alignment.End, horizontalAlignment = if (!portrait && rotation == ROTATION_270) Alignment.Start else Alignment.End, onDismiss = { viewModel.collapse() }, showEducation = viewModel.showLongPressEducation, modifier = Loading @@ -143,8 +150,13 @@ private fun TaskBarAnd3ButtonAmbientCue( translationX = screenWidthPx - size.width translationY = pillCenter.y - size.height } else { if (rotation == ROTATION_90) { translationX = screenWidthPx - pillSize.height - size.width translationY = pillCenter.y - pillSize.width } else if (rotation == ROTATION_270) { translationX = pillSize.width translationY = pillCenter.y - pillSize.width } } }, padding = Loading @@ -156,16 +168,22 @@ private fun TaskBarAnd3ButtonAmbientCue( bottom = SHORT_PILL_ACTIONS_VERTICAL_PADDING.dp, ) } else { if (rotation == ROTATION_90) { PaddingValues() } else { PaddingValues(start = ACTIONS_HORIZONTAL_PADDING.dp) } }, portrait = portrait, pillCenter = pillCenter, rotation = rotation, ) ShortPill( actions = actions, visible = visible, horizontal = portrait, expanded = expanded, rotation = rotation, modifier = if (pillPositionInWindow == null) { modifier.padding(bottom = 12.dp, end = 24.dp).onGloballyPositioned { Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.ambientcue.ui.compose import android.view.Surface.ROTATION_90 import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.TweenSpec import androidx.compose.animation.core.animateFloat Loading Loading @@ -87,6 +88,7 @@ fun ShortPill( horizontal: Boolean = true, visible: Boolean = true, expanded: Boolean = false, rotation: Int = 0, onClick: () -> Unit = {}, onCloseClick: () -> Unit = {}, ) { Loading Loading @@ -169,7 +171,11 @@ fun ShortPill( radius = if (horizontal) halfWidth else halfHeight, ) translate( left = if (horizontal) halfWidth else size.width, left = if (horizontal) halfWidth else { if (rotation == ROTATION_90) size.width else 0f }, top = if (horizontal) size.height else halfHeight, ) { scale( Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ActionList.kt +19 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.os.VibrationEffect.Composition.PRIMITIVE_LOW_TICK import android.os.VibrationEffect.Composition.PRIMITIVE_THUD import android.os.VibrationEffect.Composition.PRIMITIVE_TICK import android.os.Vibrator import android.view.Surface.ROTATION_270 import android.view.Surface.ROTATION_90 import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.Spring import androidx.compose.animation.core.animateFloatAsState Loading Loading @@ -92,6 +94,7 @@ fun ActionList( horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, portrait: Boolean = true, pillCenter: Offset = Offset.Zero, rotation: Int = 0, ) { val density = LocalDensity.current val minOverscrollDelta = (-8).dp Loading Loading @@ -344,13 +347,26 @@ fun ActionList( translationY = (1f - translation) * appxColumnY translationX = 0f } else { if (rotation == ROTATION_90) { translationY = (1f - translation) * (appxColumnY - pillCenter.y) translationX = (1f - translation) * chipWidthPx.toFloat() } else if (rotation == ROTATION_270) { translationY = (1f - translation) * (appxColumnY - pillCenter.y) translationX = (translation - 1f) * chipWidthPx.toFloat() } } scaleX = scale scaleY = scale transformOrigin = if (portrait) TransformOrigin(0.5f, 1f) else TransformOrigin(1f, 0f) if (portrait) { TransformOrigin(0.5f, 1f) } else { if (rotation == ROTATION_90) { TransformOrigin(1f, 0f) } else { TransformOrigin(0f, 0f) } } }, ) } Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt +22 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.ambientcue.ui.compose import android.content.res.Configuration import android.view.Surface.ROTATION_270 import android.view.Surface.ROTATION_90 import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues Loading @@ -38,6 +40,7 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.layout.boundsInParent import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.toSize Loading Loading @@ -130,11 +133,15 @@ private fun TaskBarAnd3ButtonAmbientCue( LaunchedEffect(expanded, touchableRegion) { onShouldInterceptTouches(true, if (expanded) null else touchableRegion) } val content = LocalContext.current val rotation = content.display.rotation ActionList( actions = actions, visible = visible, expanded = expanded, horizontalAlignment = Alignment.End, horizontalAlignment = if (!portrait && rotation == ROTATION_270) Alignment.Start else Alignment.End, onDismiss = { viewModel.collapse() }, showEducation = viewModel.showLongPressEducation, modifier = Loading @@ -143,8 +150,13 @@ private fun TaskBarAnd3ButtonAmbientCue( translationX = screenWidthPx - size.width translationY = pillCenter.y - size.height } else { if (rotation == ROTATION_90) { translationX = screenWidthPx - pillSize.height - size.width translationY = pillCenter.y - pillSize.width } else if (rotation == ROTATION_270) { translationX = pillSize.width translationY = pillCenter.y - pillSize.width } } }, padding = Loading @@ -156,16 +168,22 @@ private fun TaskBarAnd3ButtonAmbientCue( bottom = SHORT_PILL_ACTIONS_VERTICAL_PADDING.dp, ) } else { if (rotation == ROTATION_90) { PaddingValues() } else { PaddingValues(start = ACTIONS_HORIZONTAL_PADDING.dp) } }, portrait = portrait, pillCenter = pillCenter, rotation = rotation, ) ShortPill( actions = actions, visible = visible, horizontal = portrait, expanded = expanded, rotation = rotation, modifier = if (pillPositionInWindow == null) { modifier.padding(bottom = 12.dp, end = 24.dp).onGloballyPositioned { Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.ambientcue.ui.compose import android.view.Surface.ROTATION_90 import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.TweenSpec import androidx.compose.animation.core.animateFloat Loading Loading @@ -87,6 +88,7 @@ fun ShortPill( horizontal: Boolean = true, visible: Boolean = true, expanded: Boolean = false, rotation: Int = 0, onClick: () -> Unit = {}, onCloseClick: () -> Unit = {}, ) { Loading Loading @@ -169,7 +171,11 @@ fun ShortPill( radius = if (horizontal) halfWidth else halfHeight, ) translate( left = if (horizontal) halfWidth else size.width, left = if (horizontal) halfWidth else { if (rotation == ROTATION_90) size.width else 0f }, top = if (horizontal) size.height else halfHeight, ) { scale( Loading