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

Commit 88068450 authored by Chaohui Wang's avatar Chaohui Wang Committed by Android (Google) Code Review
Browse files

Merge "Fine tune App Info and App Buttons"

parents b79806ed fd05e123
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ object SettingsDimension {
    /** The size when app icon is displayed in App info page. */
    val appIconInfoSize = 48.dp

    /** The [PaddingValues] for buttons. */
    val buttonPadding = PaddingValues(horizontal = itemPaddingEnd, vertical = 12.dp)

    /** The sizes info of illustration widget. */
    val illustrationMaxWidth = 412.dp
    val illustrationMaxHeight = 300.dp
+4 −0
Original line number Diff line number Diff line
@@ -142,3 +142,7 @@ internal fun rememberSettingsTypography(): Typography {
    val settingsFontFamily = rememberSettingsFontFamily()
    return remember { SettingsTypography(settingsFontFamily).typography }
}

/** Creates a new [TextStyle] which font weight set to medium. */
internal fun TextStyle.toMediumWeight() =
    copy(fontWeight = FontWeight.Medium, letterSpacing = 0.01.em)
+3 −5
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ data class ActionButton(
fun ActionButtons(actionButtons: List<ActionButton>) {
    Row(
        Modifier
            .padding(SettingsDimension.itemPaddingVertical)
            .padding(SettingsDimension.buttonPadding)
            .clip(SettingsShape.CornerLarge)
            .height(IntrinsicSize.Min)
    ) {
@@ -94,9 +94,7 @@ private fun RowScope.ActionButton(actionButton: ActionButton) {
        ),
        contentPadding = PaddingValues(horizontal = 4.dp, vertical = 20.dp),
    ) {
        Column(
            horizontalAlignment = Alignment.CenterHorizontally,
        ) {
        Column(horizontalAlignment = Alignment.CenterHorizontally) {
            Icon(
                imageVector = actionButton.imageVector,
                contentDescription = null,
@@ -105,7 +103,7 @@ private fun RowScope.ActionButton(actionButton: ActionButton) {
            Spacer(Modifier.height(4.dp))
            Text(
                text = actionButton.text,
                style = MaterialTheme.typography.labelLarge,
                style = MaterialTheme.typography.labelMedium,
            )
        }
    }
+10 −4
Original line number Diff line number Diff line
@@ -30,18 +30,24 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.framework.theme.toMediumWeight

@Composable
fun SettingsTitle(title: State<String>) {
    SettingsTitle(title.value)
fun SettingsTitle(title: State<String>, useMediumWeight: Boolean = false) {
    SettingsTitle(title.value, useMediumWeight)
}

@Composable
fun SettingsTitle(title: String) {
fun SettingsTitle(title: String, useMediumWeight: Boolean = false) {
    Text(
        text = title,
        color = MaterialTheme.colorScheme.onSurface,
        style = MaterialTheme.typography.titleMedium,
        style = MaterialTheme.typography.titleMedium.let {
            when (useMediumWeight) {
                true -> it.toMediumWeight()
                else -> it
            }
        },
    )
}

+1 −1
Original line number Diff line number Diff line
@@ -101,5 +101,5 @@ internal fun AppIcon(app: ApplicationInfo, size: Dp) {
@Composable
internal fun AppLabel(app: ApplicationInfo) {
    val appRepository = rememberAppRepository()
    SettingsTitle(appRepository.produceLabel(app))
    SettingsTitle(title = appRepository.produceLabel(app), useMediumWeight = true)
}
Loading