Loading packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt +27 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.compose import android.graphics.drawable.Drawable import androidx.annotation.DrawableRes import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues Loading @@ -34,6 +35,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.android.compose.ui.graphics.painter.rememberDrawablePainter @Composable fun PlatformButton( Loading Loading @@ -120,6 +122,31 @@ fun PlatformIconButton( } } @Composable fun PlatformIconButton( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, colors: IconButtonColors = iconButtonColors(), shape: Shape = IconButtonDefaults.standardShape, iconDrawable: Drawable, contentDescription: String?, ) { IconButton( modifier = modifier, onClick = onClick, enabled = enabled, colors = colors, shape = shape, ) { Icon( painter = rememberDrawablePainter(iconDrawable), contentDescription = contentDescription, tint = colors.contentColor, ) } } private val ButtonPaddings = PaddingValues(horizontal = 16.dp, vertical = 8.dp) @Composable Loading packages/SystemUI/src/com/android/systemui/media/remedia/ui/compose/Media.kt +21 −8 Original line number Diff line number Diff line Loading @@ -1244,14 +1244,27 @@ private fun SecondaryActionContent( val sharedModifier = modifier.size(48.dp).padding(13.dp) when (viewModel) { is MediaSecondaryActionViewModel.Action -> when (viewModel.icon) { is Icon.Resource -> PlatformIconButton( onClick = viewModel.onClick ?: {}, iconResource = (viewModel.icon as Icon.Resource).res, contentDescription = viewModel.icon.contentDescription?.load(), colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), modifier = sharedModifier, enabled = viewModel.onClick != null, colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), iconResource = viewModel.icon.res, contentDescription = viewModel.icon.contentDescription?.load(), ) is Icon.Loaded -> PlatformIconButton( onClick = viewModel.onClick ?: {}, modifier = sharedModifier, enabled = viewModel.onClick != null, colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), iconDrawable = viewModel.icon.drawable, contentDescription = viewModel.icon.contentDescription?.load(), ) } is MediaSecondaryActionViewModel.ReserveSpace -> Spacer(modifier = sharedModifier) Loading Loading
packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt +27 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.compose import android.graphics.drawable.Drawable import androidx.annotation.DrawableRes import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.PaddingValues Loading @@ -34,6 +35,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.android.compose.ui.graphics.painter.rememberDrawablePainter @Composable fun PlatformButton( Loading Loading @@ -120,6 +122,31 @@ fun PlatformIconButton( } } @Composable fun PlatformIconButton( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, colors: IconButtonColors = iconButtonColors(), shape: Shape = IconButtonDefaults.standardShape, iconDrawable: Drawable, contentDescription: String?, ) { IconButton( modifier = modifier, onClick = onClick, enabled = enabled, colors = colors, shape = shape, ) { Icon( painter = rememberDrawablePainter(iconDrawable), contentDescription = contentDescription, tint = colors.contentColor, ) } } private val ButtonPaddings = PaddingValues(horizontal = 16.dp, vertical = 8.dp) @Composable Loading
packages/SystemUI/src/com/android/systemui/media/remedia/ui/compose/Media.kt +21 −8 Original line number Diff line number Diff line Loading @@ -1244,14 +1244,27 @@ private fun SecondaryActionContent( val sharedModifier = modifier.size(48.dp).padding(13.dp) when (viewModel) { is MediaSecondaryActionViewModel.Action -> when (viewModel.icon) { is Icon.Resource -> PlatformIconButton( onClick = viewModel.onClick ?: {}, iconResource = (viewModel.icon as Icon.Resource).res, contentDescription = viewModel.icon.contentDescription?.load(), colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), modifier = sharedModifier, enabled = viewModel.onClick != null, colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), iconResource = viewModel.icon.res, contentDescription = viewModel.icon.contentDescription?.load(), ) is Icon.Loaded -> PlatformIconButton( onClick = viewModel.onClick ?: {}, modifier = sharedModifier, enabled = viewModel.onClick != null, colors = IconButtonDefaults.iconButtonColors(contentColor = iconColor), iconDrawable = viewModel.icon.drawable, contentDescription = viewModel.icon.contentDescription?.load(), ) } is MediaSecondaryActionViewModel.ReserveSpace -> Spacer(modifier = sharedModifier) Loading