diff options
| author | 2024-04-15 14:15:58 +0100 | |
|---|---|---|
| committer | 2024-04-15 14:51:59 +0100 | |
| commit | 342097518d32bfe871d11bcf91cb81b2001076a5 (patch) | |
| tree | 73d5515e1c0d2b77f08bc21dcfac3ad2bd09791f | |
| parent | 020580d714d1afa8acd209fd6651eb59069ca39d (diff) | |
Rework VolumePanel clicks modifiers
Flag: aconfig new_volume_panel TRUNKFOOD
Test: manual on the phone with voiceover turned on. Open volumepanel and
observe the announcement order
Fixes: 331155283
Change-Id: Ie4ecce5680c1fcc324db046a6209126b7960b471
| -rw-r--r-- | packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt | 25 | 
1 files changed, 14 insertions, 11 deletions
| diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt index 910cd5ec107b..1bf541a92070 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt @@ -16,7 +16,7 @@  package com.android.systemui.volume.panel.ui.composable -import androidx.compose.foundation.clickable +import androidx.compose.foundation.gestures.detectTapGestures  import androidx.compose.foundation.isSystemInDarkTheme  import androidx.compose.foundation.layout.Arrangement  import androidx.compose.foundation.layout.Box @@ -38,6 +38,7 @@ import androidx.compose.runtime.collectAsState  import androidx.compose.runtime.getValue  import androidx.compose.ui.Alignment  import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.pointerInput  import androidx.compose.ui.platform.LocalDensity  import androidx.compose.ui.platform.LocalLayoutDirection  import androidx.compose.ui.res.dimensionResource @@ -75,21 +76,13 @@ fun VolumePanelRoot(                  modifier =                      modifier                          .fillMaxSize() -                        .clickable(onClick = onDismiss) +                        .volumePanelClick(onDismiss)                          .volumePanelPaddings(isPortrait = isPortrait),                  contentAlignment = Alignment.BottomCenter,              ) {                  val radius = dimensionResource(R.dimen.volume_panel_corner_radius)                  Surface( -                    modifier = -                        Modifier.clickable( -                            interactionSource = null, -                            indication = null, -                            onClick = { -                                // prevent windowCloseOnTouchOutside from dismissing when tapped -                                // on the panel itself. -                            }, -                        ), +                    modifier = Modifier.volumePanelClick {},                      shape = RoundedCornerShape(topStart = radius, topEnd = radius),                      color = MaterialTheme.colorScheme.surfaceContainer,                  ) { @@ -185,3 +178,13 @@ private fun Modifier.volumePanelPaddings(isPortrait: Boolean): Modifier {          )      }  } + +/** + * For some reason adding clickable modifier onto the VolumePanel affects the traversal order: + * b/331155283. + * + * TODO(b/334870995) revert this to Modifier.clickable + */ +@Composable +private fun Modifier.volumePanelClick(onClick: () -> Unit) = +    pointerInput(onClick) { detectTapGestures { onClick() } } |