Skip to content

Commit cd5e746

Browse files
neobuddy89joeyhuab
authored andcommitted
SystemUI: DynamicBar: Align expanded cards to top center
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
1 parent 28f19fa commit cd5e746

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

packages/SystemUI/src/com/android/systemui/axdynamicbar/ui/AxDynamicBarExpandedPanel.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import androidx.compose.runtime.getValue
2424
import androidx.compose.runtime.mutableStateOf
2525
import androidx.compose.runtime.remember
2626
import androidx.compose.ui.Alignment
27-
import androidx.compose.ui.BiasAlignment
2827
import androidx.compose.ui.Modifier
2928
import androidx.compose.ui.graphics.TransformOrigin
3029
import androidx.compose.ui.input.pointer.PointerEventPass
@@ -273,11 +272,6 @@ private fun OverlayContent(viewModel: AxDynamicBarChipViewModel, statusBarHeight
273272

274273
val originX = chipX
275274
val origin = TransformOrigin(originX, 0f)
276-
277-
val chipAlignment = BiasAlignment(
278-
horizontalBias = originX * 2f - 1f,
279-
verticalBias = -1f,
280-
)
281275

282276
AnimatedVisibility(
283277
visibleState = expandedVisible,
@@ -325,7 +319,7 @@ private fun OverlayContent(viewModel: AxDynamicBarChipViewModel, statusBarHeight
325319
}
326320
}
327321
.padding(top = topPad),
328-
contentAlignment = chipAlignment,
322+
contentAlignment = Alignment.TopCenter,
329323
) {
330324
chipState?.let { state ->
331325
ExpandedIslandContent(
@@ -339,24 +333,26 @@ private fun OverlayContent(viewModel: AxDynamicBarChipViewModel, statusBarHeight
339333
}
340334
}
341335

336+
val alertOrigin = TransformOrigin(0.5f, 0f)
337+
342338
AnimatedVisibility(
343339
visibleState = notifVisible,
344340
enter = fadeIn(tween(300)) + scaleIn(
345341
animationSpec = tween(300),
346342
initialScale = 0.4f,
347-
transformOrigin = origin,
343+
transformOrigin = alertOrigin,
348344
),
349345
exit = fadeOut(tween(250)) + scaleOut(
350346
animationSpec = tween(250),
351347
targetScale = 0.4f,
352-
transformOrigin = origin,
348+
transformOrigin = alertOrigin,
353349
),
354350
) {
355351
Box(
356352
modifier = Modifier
357353
.fillMaxWidth()
358354
.padding(top = topPad),
359-
contentAlignment = chipAlignment,
355+
contentAlignment = Alignment.TopCenter,
360356
) {
361357
val alert = lastAlert.value
362358
if (alert != null) {
@@ -393,4 +389,3 @@ private class PanelLifecycleOwner : LifecycleOwner, SavedStateRegistryOwner {
393389
lifecycleRegistry.handleLifecycleEvent(event)
394390
}
395391
}
396-

0 commit comments

Comments
 (0)