Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt +17 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier Loading @@ -44,6 +45,8 @@ import com.android.systemui.ambientcue.ui.viewmodel.ActionViewModel import com.android.systemui.ambientcue.ui.viewmodel.AmbientCueViewModel import com.android.systemui.ambientcue.ui.viewmodel.PillStyleViewModel import com.android.systemui.lifecycle.rememberViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch @Composable fun AmbientCueContainer( Loading Loading @@ -196,6 +199,8 @@ private fun NavBarAmbientCue( if (windowWidthSizeClass == WindowWidthSizeClass.Compact) NAV_BAR_PILL_WIDTH_DP.dp else NAV_BAR_PILL_LARGE_WIDTH_DP.dp val scope = rememberCoroutineScope() LaunchedEffect(expanded) { onShouldInterceptTouches(expanded, null) } ActionList( actions = actions, Loading @@ -218,7 +223,16 @@ private fun NavBarAmbientCue( expanded = expanded, showEducation = viewModel.showFirstTimeEducation, modifier = modifier, onClick = { viewModel.expand() }, onClick = { if (actions.size == 1 && actions[0].oneTapEnabled) { scope.launch { delay(ONE_TAP_DELAY_MS) actions[0].onClick() } } else { viewModel.expand() } }, onCloseClick = { viewModel.hide() }, ) } Loading @@ -232,3 +246,5 @@ private const val NAV_BAR_HEIGHT_DP = 24 // R.dimen.taskbar_stashed_size from La 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 ONE_TAP_DELAY_MS = 500L packages/SystemUI/src/com/android/systemui/ambientcue/data/repository/AmbientCueRepository.kt +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ constructor( val activityId = chip.extras?.getParcelable<ActivityId>(EXTRA_ACTIVITY_ID) val actionType = chip.extras?.getString(EXTRA_ACTION_TYPE) val oneTapEnabled = chip.extras?.getBoolean(EXTRA_ONE_TAP_ENABLED) ActionModel( icon = IconModel( Loading Loading @@ -228,6 +229,7 @@ constructor( }, taskId = activityId?.taskId ?: INVALID_TASK_ID, actionType = actionType, oneTapEnabled = oneTapEnabled == true, ) } if (DEBUG) { Loading Loading @@ -403,6 +405,7 @@ constructor( @VisibleForTesting const val EXTRA_ATTRIBUTION_DIALOG_PENDING_INTENT = "attributionDialogPendingIntent" @VisibleForTesting const val EXTRA_ACTION_TYPE = "actionType" private const val EXTRA_ONE_TAP_ENABLED = "oneTapEnabled" // Timeout to hide cuebar if it wasn't interacted with private const val TAG = "AmbientCueRepository" Loading packages/SystemUI/src/com/android/systemui/ambientcue/shared/model/ActionModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ data class ActionModel( val onPerformLongClick: () -> Unit, val taskId: Int = INVALID_TASK_ID, val actionType: String? = null, val oneTapEnabled: Boolean = false, ) data class IconModel(val drawable: Drawable, val iconId: String) packages/SystemUI/src/com/android/systemui/ambientcue/ui/viewmodel/ActionViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ data class ActionViewModel( val onClick: () -> Unit, val onLongClick: () -> Unit, val actionType: ActionType, val oneTapEnabled: Boolean = false, ) enum class ActionType { Loading packages/SystemUI/src/com/android/systemui/ambientcue/ui/viewmodel/AmbientCueViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ constructor( "mr" -> ActionType.MR else -> ActionType.Unknown }, oneTapEnabled = action.oneTapEnabled, ) } }, Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/AmbientCueContainer.kt +17 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier Loading @@ -44,6 +45,8 @@ import com.android.systemui.ambientcue.ui.viewmodel.ActionViewModel import com.android.systemui.ambientcue.ui.viewmodel.AmbientCueViewModel import com.android.systemui.ambientcue.ui.viewmodel.PillStyleViewModel import com.android.systemui.lifecycle.rememberViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch @Composable fun AmbientCueContainer( Loading Loading @@ -196,6 +199,8 @@ private fun NavBarAmbientCue( if (windowWidthSizeClass == WindowWidthSizeClass.Compact) NAV_BAR_PILL_WIDTH_DP.dp else NAV_BAR_PILL_LARGE_WIDTH_DP.dp val scope = rememberCoroutineScope() LaunchedEffect(expanded) { onShouldInterceptTouches(expanded, null) } ActionList( actions = actions, Loading @@ -218,7 +223,16 @@ private fun NavBarAmbientCue( expanded = expanded, showEducation = viewModel.showFirstTimeEducation, modifier = modifier, onClick = { viewModel.expand() }, onClick = { if (actions.size == 1 && actions[0].oneTapEnabled) { scope.launch { delay(ONE_TAP_DELAY_MS) actions[0].onClick() } } else { viewModel.expand() } }, onCloseClick = { viewModel.hide() }, ) } Loading @@ -232,3 +246,5 @@ private const val NAV_BAR_HEIGHT_DP = 24 // R.dimen.taskbar_stashed_size from La 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 ONE_TAP_DELAY_MS = 500L
packages/SystemUI/src/com/android/systemui/ambientcue/data/repository/AmbientCueRepository.kt +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ constructor( val activityId = chip.extras?.getParcelable<ActivityId>(EXTRA_ACTIVITY_ID) val actionType = chip.extras?.getString(EXTRA_ACTION_TYPE) val oneTapEnabled = chip.extras?.getBoolean(EXTRA_ONE_TAP_ENABLED) ActionModel( icon = IconModel( Loading Loading @@ -228,6 +229,7 @@ constructor( }, taskId = activityId?.taskId ?: INVALID_TASK_ID, actionType = actionType, oneTapEnabled = oneTapEnabled == true, ) } if (DEBUG) { Loading Loading @@ -403,6 +405,7 @@ constructor( @VisibleForTesting const val EXTRA_ATTRIBUTION_DIALOG_PENDING_INTENT = "attributionDialogPendingIntent" @VisibleForTesting const val EXTRA_ACTION_TYPE = "actionType" private const val EXTRA_ONE_TAP_ENABLED = "oneTapEnabled" // Timeout to hide cuebar if it wasn't interacted with private const val TAG = "AmbientCueRepository" Loading
packages/SystemUI/src/com/android/systemui/ambientcue/shared/model/ActionModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ data class ActionModel( val onPerformLongClick: () -> Unit, val taskId: Int = INVALID_TASK_ID, val actionType: String? = null, val oneTapEnabled: Boolean = false, ) data class IconModel(val drawable: Drawable, val iconId: String)
packages/SystemUI/src/com/android/systemui/ambientcue/ui/viewmodel/ActionViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ data class ActionViewModel( val onClick: () -> Unit, val onLongClick: () -> Unit, val actionType: ActionType, val oneTapEnabled: Boolean = false, ) enum class ActionType { Loading
packages/SystemUI/src/com/android/systemui/ambientcue/ui/viewmodel/AmbientCueViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ constructor( "mr" -> ActionType.MR else -> ActionType.Unknown }, oneTapEnabled = action.oneTapEnabled, ) } }, Loading