Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e482bab3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pin bouncer color and font changes to match non-flexi bouncer specs" into main

parents 72f87516 bcff018f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -843,7 +843,7 @@ private fun ActionArea(viewModel: BouncerOverlayContentViewModel, modifier: Modi
                    }
                    .height(56.dp)
                    .clip(ButtonDefaults.shape)
                    .background(color = MaterialTheme.colorScheme.tertiaryContainer)
                    .background(color = MaterialTheme.colorScheme.secondaryContainer)
                    .semantics { role = Role.Button }
                    .combinedClickable(
                        onClick = { actionButton?.let { viewModel.onActionButtonClicked(it) } },
@@ -854,8 +854,8 @@ private fun ActionArea(viewModel: BouncerOverlayContentViewModel, modifier: Modi
        ) {
            Text(
                text = stringResource(id = actionButtonModel.labelResId),
                style = MaterialTheme.typography.bodyMedium,
                color = MaterialTheme.colorScheme.onTertiaryContainer,
                style = MaterialTheme.typography.titleMedium,
                color = MaterialTheme.colorScheme.onSecondaryContainer,
                modifier = Modifier.align(Alignment.Center).padding(ButtonDefaults.ContentPadding),
            )
        }
@@ -941,7 +941,7 @@ private fun UserSwitcher(viewModel: BouncerOverlayContentViewModel, modifier: Mo
                    val context = LocalContext.current
                    Text(
                        text = checkNotNull(firstDropdownItem.text.loadText(context)),
                        style = MaterialTheme.typography.headlineSmall,
                        style = MaterialTheme.typography.labelMedium,
                        maxLines = 1,
                        overflow = TextOverflow.Ellipsis,
                    )
+18 −13
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -60,6 +61,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.Easings
import com.android.compose.grid.VerticalGrid
import com.android.compose.modifiers.thenIf
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.systemui.bouncer.ui.viewmodel.ActionButtonAppearance
import com.android.systemui.bouncer.ui.viewmodel.PinBouncerViewModel
import com.android.systemui.common.shared.model.ContentDescription
@@ -121,7 +123,12 @@ fun PinPad(viewModel: PinBouncerViewModel, verticalSpacing: Dp, modifier: Modifi
        ActionButton(
            icon =
                Icon.Resource(
                    res = R.drawable.ic_backspace_24dp,
                    res =
                        if (backspaceButtonAppearance == ActionButtonAppearance.Shown) {
                            R.drawable.pin_bouncer_delete_outline
                        } else {
                            R.drawable.pin_bouncer_delete_filled
                        },
                    contentDescription =
                        ContentDescription.Resource(R.string.keyboardview_keycode_delete),
                ),
@@ -146,7 +153,7 @@ fun PinPad(viewModel: PinBouncerViewModel, verticalSpacing: Dp, modifier: Modifi
        ActionButton(
            icon =
                Icon.Resource(
                    res = R.drawable.ic_keyboard_tab_36dp,
                    res = R.drawable.pin_bouncer_confirm,
                    contentDescription =
                        ContentDescription.Resource(R.string.keyboardview_keycode_enter),
                ),
@@ -160,6 +167,7 @@ fun PinPad(viewModel: PinBouncerViewModel, verticalSpacing: Dp, modifier: Modifi
}

@Composable
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
private fun DigitButton(
    digit: Int,
    isInputEnabled: Boolean,
@@ -171,8 +179,8 @@ private fun DigitButton(
    PinPadButton(
        onClicked = { onClicked(digit) },
        isEnabled = isInputEnabled,
        backgroundColor = MaterialTheme.colorScheme.surfaceVariant,
        foregroundColor = MaterialTheme.colorScheme.onSurfaceVariant,
        backgroundColor = LocalAndroidColorScheme.current.surfaceEffect1,
        foregroundColor = MaterialTheme.colorScheme.onSurface,
        isAnimationEnabled = isAnimationEnabled,
        onPointerDown = onPointerDown,
        modifier =
@@ -186,7 +194,7 @@ private fun DigitButton(
        // it into Text, use that here, to animate more efficiently.
        Text(
            text = digit.toString(),
            style = MaterialTheme.typography.headlineLarge,
            style = MaterialTheme.typography.displaySmallEmphasized,
            color = contentColor(),
        )
    }
@@ -206,15 +214,12 @@ private fun ActionButton(
    val isHidden = appearance == ActionButtonAppearance.Hidden
    val hiddenAlpha by animateFloatAsState(if (isHidden) 0f else 1f, label = "Action button alpha")

    val foregroundColor =
        when (appearance) {
            ActionButtonAppearance.Shown -> MaterialTheme.colorScheme.onSecondaryContainer
            else -> MaterialTheme.colorScheme.onSurface
        }
    val foregroundColor = MaterialTheme.colorScheme.onSurface

    val backgroundColor =
        when (appearance) {
            ActionButtonAppearance.Shown -> MaterialTheme.colorScheme.secondaryContainer
            else -> MaterialTheme.colorScheme.surface
            ActionButtonAppearance.Shown -> LocalAndroidColorScheme.current.surfaceEffect0
            else -> Color.Transparent
        }

    PinPadButton(
@@ -360,7 +365,7 @@ private fun calculateHorizontalSpacingBetweenColumns(gridWidth: Dp): Dp {
/** Number of columns in the PIN pad grid. */
private const val columns = 3
/** Maximum size (width and height) of each PIN pad button. */
private val pinButtonMaxSize = 84.dp
private val pinButtonMaxSize = 96.dp
/** Scale factor to apply to buttons when animating the "error" animation on them. */
private val pinButtonErrorShrinkFactor = 67.dp / pinButtonMaxSize
/** Animation duration of the "shrink" phase of the error animation, on each PIN pad button. */
+5 −3
Original line number Diff line number Diff line
@@ -72,8 +72,10 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.PlatformOutlinedButton
import com.android.compose.animation.Easings
import com.android.compose.modifiers.size
import com.android.compose.modifiers.thenIf
import com.android.keyguard.PinShapeAdapter
import com.android.systemui.bouncer.shared.constants.PinBouncerConstants
import com.android.systemui.bouncer.ui.viewmodel.EntryToken.Digit
import com.android.systemui.bouncer.ui.viewmodel.PinBouncerViewModel
import com.android.systemui.bouncer.ui.viewmodel.PinInputViewModel
@@ -188,7 +190,7 @@ private fun HintingPinInputDisplay(
    var playAnimation by remember { mutableStateOf(false) }
    LaunchedEffect(Unit) { playAnimation = true }

    val dotColor = MaterialTheme.colorScheme.onSurfaceVariant
    val dotColor = MaterialTheme.colorScheme.onSurface
    Row(
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.Center,
@@ -502,7 +504,7 @@ private class PinInputEntry(val digit: Digit, val shapeAnimations: ShapeAnimatio
        val animatedShapeSize by shapeSize.asState()
        val animatedEntryWidth by entryWidth.asState()

        val dotColor = MaterialTheme.colorScheme.onSurfaceVariant
        val dotColor = MaterialTheme.colorScheme.onSurface
        val shapeHeight = shapeAnimations.shapeSize
        var atEnd by remember { mutableStateOf(false) }
        LaunchedEffect(Unit) { atEnd = true }
@@ -564,7 +566,7 @@ private class ShapeAnimations(
@Composable
private fun rememberShapeAnimations(pinShapes: PinShapeAdapter): ShapeAnimations {
    // NOTE: `animatedVectorResource` does remember the returned AnimatedImageVector.
    val dotToCircle = AnimatedImageVector.animatedVectorResource(R.drawable.pin_dot_delete_avd)
    val dotToCircle = AnimatedImageVector.animatedVectorResource(PinBouncerConstants.pinDotAvd)
    val shapesToDot = pinShapes.shapes.map { AnimatedImageVector.animatedVectorResource(it) }
    val shapeSize = dimensionResource(R.dimen.password_shape_size)