Updated Button, IconButton and TextButton following updates to Material3 design
Ensure all text fits on the screen with largest font sizes.
Allow semantic role to be overridden for IconButton and TextButton.
Increased the number of items in ScrollAway demos to help testing with rotary.
Bug: 291062960
Bug: 291062329
Bug: 291061710
Bug: 291060301
Bug: 291060489
Bug: 291061410
Bug: 290617178
Test: Manual testing + screenshot tests
Relnote: "We have updated the colors for Button, IconButton and TextButton in line with Material3 design. The semantic role for Button, IconButton and TextButton can now be overridden using Modifier.semantics."
Change-Id: Ib24954145bc5440092cc2ac7dd18d3bc4fd4b756
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
index e389f5c..9284438 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
@@ -34,6 +34,8 @@
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
/**
@@ -80,14 +82,16 @@
.clickable(
>
enabled = enabled,
- role = Role.Button,
+ role = null, // provide the role via Modifier.semantics
interactionSource = interactionSource,
indication = rememberRipple(),
)
.then(
// Make sure modifier ordering is clip > clickable > padding > size,
// so that the ripple applies to the entire button shape and size.
+ // Then, apply semantics to apply the default semantic role (can be overridden)
modifier
+ .semantics { role = Role.Button }
)
.size(buttonSize)
.clip(shape) // Clip for the painted background area after size has been applied.
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
index 76cddf8..d2c396f 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/ButtonDemo.kt
@@ -29,6 +29,7 @@
import androidx.compose.ui.text.style.TextOverflow
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.material3.Button
+import androidx.wear.compose.material3.ButtonColors
import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.ChildButton
import androidx.wear.compose.material3.FilledTonalButton
@@ -310,13 +311,17 @@
@Composable
private fun AvatarButton(enabled: Boolean) =
MultilineButton(
- enabled = enabled, icon = { AvatarIcon() }, label = { Text("Primary text") }
+ enabled = enabled,
+ colors = ButtonDefaults.filledTonalButtonColors(),
+ icon = { AvatarIcon() },
+ label = { Text("Primary text") }
)
@Composable
private fun Avatar3SlotButton(enabled: Boolean) =
Multiline3SlotButton(
enabled = enabled,
+ colors = ButtonDefaults.filledTonalButtonColors(),
icon = { AvatarIcon() },
label = { Text("Primary text") },
secondaryLabel = { Text("Secondary label") }
@@ -325,6 +330,7 @@
@Composable
private fun MultilineButton(
enabled: Boolean,
+ colors: ButtonColors = ButtonDefaults.filledButtonColors(),
icon: (@Composable BoxScope.() -> Unit)? = null,
label: @Composable RowScope.() -> Unit = {
Text(
@@ -338,13 +344,15 @@
/* Do something */ },
icon = icon,
label = label,
- enabled = enabled
+ enabled = enabled,
+ colors = colors,
)
}
@Composable
private fun Multiline3SlotButton(
enabled: Boolean,
+ colors: ButtonColors = ButtonDefaults.filledButtonColors(),
icon: (@Composable BoxScope.() -> Unit)? = null,
label: @Composable RowScope.() -> Unit = {
Text(
@@ -366,7 +374,8 @@
icon = icon,
label = label,
secondaryLabel = secondaryLabel,
- enabled = enabled
+ enabled = enabled,
+ colors = colors,
)
}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
index eb4b7c0..a5da87e 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ButtonTest.kt
@@ -386,7 +386,7 @@
status = Status.Disabled,
colors = { ButtonDefaults.filledButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -412,7 +412,7 @@
status = Status.Disabled,
colors = { ButtonDefaults.filledTonalButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -461,9 +461,7 @@
rule.verifyButtonColors(
status = Status.Disabled,
colors = { ButtonDefaults.childButtonColors() },
- expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
- ) },
+ expectedContainerColor = { Color.Transparent },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
) },
@@ -563,7 +561,9 @@
fun gives_disabled_outlined_button_correct_border_colors() {
val status = Status.Disabled
rule.verifyButtonBorderColor(
- expectedBorderColor = { MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f) },
+ expectedBorderColor = {
+ MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledBorderAlpha)
+ },
content = { modifier: Modifier ->
OutlinedButton(
>
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonScreenshotTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonScreenshotTest.kt
index e1bcf92..07d2ceb 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonScreenshotTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonScreenshotTest.kt
@@ -70,7 +70,7 @@
}
@Test
- fun filled_icon_button_disabled() = verifyScreenshot("icon_button_disabled") {
+ fun filled_icon_button_disabled() = verifyScreenshot {
sampleFilledIconButton(enabled = false, isCompact = false)
}
@@ -80,7 +80,7 @@
}
@Test
- fun filled_tonal_icon_button_disabled() = verifyScreenshot("icon_button_disabled") {
+ fun filled_tonal_icon_button_disabled() = verifyScreenshot {
sampleFilledTonalIconButton(enabled = false, isCompact = false)
}
@@ -110,7 +110,7 @@
}
@Test
- fun filled_compact_icon_button_disabled() = verifyScreenshot("compact_icon_button_disabled") {
+ fun filled_compact_icon_button_disabled() = verifyScreenshot {
sampleFilledIconButton(enabled = false, isCompact = true)
}
@@ -121,7 +121,7 @@
@Test
fun filled_tonal_compact_icon_button_disabled() =
- verifyScreenshot("compact_icon_button_disabled") {
+ verifyScreenshot {
sampleFilledTonalIconButton(enabled = false, isCompact = true)
}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonTest.kt
index d12eb43..f6f9e3b 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/IconButtonTest.kt
@@ -31,6 +31,8 @@
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.SemanticsProperties
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.test.SemanticsMatcher
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertHasClickAction
@@ -191,6 +193,27 @@
}
@Test
+ fun allows_custom_role() {
+ val overrideRole = Role.Checkbox
+
+ rule.setContentWithTheme {
+ IconButton(
+ >
+ modifier = Modifier.testTag(TEST_TAG).semantics { role = overrideRole }
+ ) {
+ TestImage()
+ }
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ overrideRole
+ )
+ )
+ }
+
+ @Test
fun gives_default_button_correct_tap_size() {
rule.verifyTapSize(DefaultButtonSize) { modifier ->
IconButton(
@@ -317,7 +340,7 @@
status = Status.Disabled,
colors = { IconButtonDefaults.filledIconButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -343,7 +366,7 @@
status = Status.Disabled,
colors = { IconButtonDefaults.filledTonalIconButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -397,7 +420,7 @@
val status = Status.Disabled
rule.verifyButtonBorderColor(
expectedBorderColor = {
- MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledBorderAndContainerAlpha)
+ MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledBorderAlpha)
},
content = { modifier: Modifier ->
OutlinedIconButton(
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonScreenshotTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonScreenshotTest.kt
index 967714f3..11b0b55 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonScreenshotTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonScreenshotTest.kt
@@ -66,7 +66,7 @@
@Test
fun filled_text_button_disabled() =
- verifyScreenshot("text_button_disabled") {
+ verifyScreenshot {
sampleFilledTextButton(enabled = false, isCompact = false)
}
@@ -77,7 +77,7 @@
@Test
fun filled_tonal_text_button_disabled() =
- verifyScreenshot("text_button_disabled") {
+ verifyScreenshot {
sampleFilledTonalTextButton(enabled = false, isCompact = false)
}
@@ -108,7 +108,7 @@
@Test
fun filled_compact_text_button_disabled() =
- verifyScreenshot("compact_text_button_disabled") {
+ verifyScreenshot {
sampleFilledTextButton(enabled = false, isCompact = true)
}
@@ -119,7 +119,7 @@
@Test
fun filled_tonal_compact_text_button_disabled() =
- verifyScreenshot("compact_text_button_disabled") {
+ verifyScreenshot {
sampleFilledTonalTextButton(enabled = false, isCompact = true)
}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonTest.kt
index a37ef7b..f6a0b7b 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/TextButtonTest.kt
@@ -31,6 +31,8 @@
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.SemanticsProperties
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.test.SemanticsMatcher
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertHasClickAction
@@ -222,6 +224,27 @@
}
@Test
+ fun allows_custom_role() {
+ val overrideRole = Role.Checkbox
+
+ rule.setContentWithTheme {
+ TextButton(
+ >
+ modifier = Modifier.testTag(TEST_TAG).semantics { role = overrideRole }
+ ) {
+ Text("Test")
+ }
+ }
+
+ rule.onNodeWithTag(TEST_TAG).assert(
+ SemanticsMatcher.expectValue(
+ SemanticsProperties.Role,
+ overrideRole
+ )
+ )
+ }
+
+ @Test
fun sets_correct_font() {
var actualTextStyle = TextStyle.Default
var expectedTextStyle = TextStyle.Default
@@ -365,7 +388,7 @@
status = Status.Disabled,
colors = { TextButtonDefaults.filledTextButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -391,7 +414,7 @@
status = Status.Disabled,
colors = { TextButtonDefaults.filledTonalTextButtonColors() },
expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
+ alpha = DisabledContainerAlpha
) },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
@@ -416,9 +439,7 @@
rule.verifyTextButtonColors(
status = Status.Disabled,
colors = { TextButtonDefaults.outlinedTextButtonColors() },
- expectedContainerColor = { MaterialTheme.colorScheme.onSurface.copy(
- alpha = DisabledBorderAndContainerAlpha
- ) },
+ expectedContainerColor = { Color.Transparent },
expectedContentColor = { MaterialTheme.colorScheme.onSurface.copy(
alpha = ContentAlpha.disabled
) }
@@ -449,7 +470,7 @@
val status = Status.Disabled
rule.verifyButtonBorderColor(
expectedBorderColor = {
- MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledBorderAndContainerAlpha)
+ MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledBorderAlpha)
},
content = { modifier: Modifier ->
TextButton(
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
index 6c8de9eb59..e608707 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
@@ -715,7 +715,7 @@
containerColor: Color = MaterialTheme.colorScheme.surface,
contentColor: Color = MaterialTheme.colorScheme.onSurface,
secondaryContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
- iconColor: Color = MaterialTheme.colorScheme.onSurface
+ iconColor: Color = MaterialTheme.colorScheme.primary,
): ButtonColors {
return buttonColors(
containerColor = containerColor,
@@ -742,13 +742,14 @@
fun outlinedButtonColors(
contentColor: Color = MaterialTheme.colorScheme.onSurface,
secondaryContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
- iconColor: Color = MaterialTheme.colorScheme.onSurface
+ iconColor: Color = MaterialTheme.colorScheme.primary,
): ButtonColors {
return buttonColors(
containerColor = Color.Transparent,
contentColor = contentColor,
secondaryContentColor = secondaryContentColor,
- iconColor = iconColor
+ iconColor = iconColor,
+ disabledContainerColor = Color.Transparent,
)
}
@@ -769,13 +770,14 @@
fun childButtonColors(
contentColor: Color = MaterialTheme.colorScheme.onSurface,
secondaryContentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
- iconColor: Color = MaterialTheme.colorScheme.onSurface
+ iconColor: Color = MaterialTheme.colorScheme.primary
): ButtonColors {
return buttonColors(
containerColor = Color.Transparent,
contentColor = contentColor,
secondaryContentColor = secondaryContentColor,
- iconColor = iconColor
+ iconColor = iconColor,
+ disabledContainerColor = Color.Transparent,
)
}
@@ -851,7 +853,7 @@
enabled: Boolean,
borderColor: Color = MaterialTheme.colorScheme.outline,
disabledBorderColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledBorderAlpha
),
borderWidth: Dp = 1.dp
): BorderStroke {
@@ -901,7 +903,7 @@
secondaryContentColor: Color = contentColor,
iconColor: Color = contentColor,
disabledContainerColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor(),
disabledSecondaryContentColor: Color =
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ContentAlpha.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ContentAlpha.kt
index 8471524..b978a2b 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ContentAlpha.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ContentAlpha.kt
@@ -33,18 +33,18 @@
* body text.
*
*/
-public val LocalContentAlpha: ProvidableCompositionLocal<Float> = compositionLocalOf { 1f }
+val LocalContentAlpha: ProvidableCompositionLocal<Float> = compositionLocalOf { 1f }
/**
* Default alpha levels used by Material components.
*
* See [LocalContentAlpha].
*/
-public object ContentAlpha {
+object ContentAlpha {
/**
* A high level of content alpha, used to represent high emphasis text.
*/
- public val high: Float
+ val high: Float
@Composable
get() = contentAlpha(
highContrastAlpha = HighContrastContentAlpha.high,
@@ -55,7 +55,7 @@
* A medium level of content alpha, used to represent medium emphasis text such as
* placeholder text.
*/
- public val medium: Float
+ val medium: Float
@Composable
get() = contentAlpha(
highContrastAlpha = HighContrastContentAlpha.medium,
@@ -66,7 +66,7 @@
* A low level of content alpha used to represent disabled components, such as text in a
* disabled Button.
*/
- public val disabled: Float
+ val disabled: Float
@Composable
get() = contentAlpha(
highContrastAlpha = HighContrastContentAlpha.disabled,
@@ -123,4 +123,5 @@
const val disabled: Float = 0.38f
}
-internal const val DisabledBorderAndContainerAlpha = 0.12f
+internal const val DisabledContainerAlpha = 0.12f
+internal const val DisabledBorderAlpha = 0.20f
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
index 042f777..ff669b8 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
@@ -358,7 +358,10 @@
): IconButtonColors {
return iconButtonColors(
containerColor = containerColor,
- contentColor = contentColor
+ contentColor = contentColor,
+ disabledContainerColor = MaterialTheme.colorScheme.onSurface.toDisabledColor(
+ disabledAlpha = DisabledContainerAlpha
+ ),
)
}
@@ -378,7 +381,10 @@
): IconButtonColors {
return iconButtonColors(
containerColor = containerColor,
- contentColor = contentColor
+ contentColor = contentColor,
+ disabledContainerColor = MaterialTheme.colorScheme.onSurface.toDisabledColor(
+ disabledAlpha = DisabledContainerAlpha
+ ),
)
}
@@ -396,7 +402,7 @@
): IconButtonColors {
return iconButtonColors(
containerColor = Color.Transparent,
- contentColor = contentColor
+ contentColor = contentColor,
)
}
@@ -415,9 +421,7 @@
fun iconButtonColors(
containerColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
- disabledContainerColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
- ),
+ disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor()
): IconButtonColors = IconButtonColors(
containerColor = containerColor,
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/SelectionControls.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/SelectionControls.kt
index adf549b..128b9a5 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/SelectionControls.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/SelectionControls.kt
@@ -491,11 +491,11 @@
uncheckedBoxColor = uncheckedBoxColor,
uncheckedCheckmarkColor = uncheckedCheckmarkColor,
disabledCheckedBoxColor = checkedBoxColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledCheckedCheckmarkColor = checkedCheckmarkColor.toDisabledColor(),
disabledUncheckedBoxColor = uncheckedBoxColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledUncheckedCheckmarkColor = uncheckedCheckmarkColor.toDisabledColor()
)
@@ -539,18 +539,18 @@
disabledCheckedThumbColor = checkedThumbColor.toDisabledColor(),
disabledCheckedThumbIconColor = checkedThumbIconColor.toDisabledColor(),
disabledCheckedTrackColor = checkedTrackColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledCheckedTrackBorderColor = checkedTrackStrokeColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledBorderAlpha
),
disabledUncheckedThumbColor = uncheckedThumbColor.toDisabledColor(),
disabledUncheckedThumbIconColor = uncheckedThumbIconColor.toDisabledColor(),
disabledUncheckedTrackColor = uncheckedTrackColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledUncheckedTrackBorderColor = uncheckedTrackStrokeColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledBorderAlpha
)
)
}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
index d6a155f..9563288 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Slider.kt
@@ -328,13 +328,13 @@
unselectedBarColor: Color = MaterialTheme.colorScheme.background.copy(alpha = 0.3f),
barSeparatorColor: Color = MaterialTheme.colorScheme.primaryDim,
disabledContainerColor: Color = containerColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
),
disabledButtonIconColor: Color = buttonIconColor.toDisabledColor(),
disabledSelectedBarColor: Color = selectedBarColor.toDisabledColor(),
disabledUnselectedBarColor: Color = unselectedBarColor.toDisabledColor(),
disabledBarSeparatorColor: Color = barSeparatorColor.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
+ disabledAlpha = DisabledContainerAlpha
)
): InlineSliderColors = InlineSliderColors(
containerColor = containerColor,
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
index f3d2722..e0349a1 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
@@ -135,7 +135,7 @@
* @param content The text to be drawn inside the toggle button.
*/
@Composable
-public fun TextToggleButton(
+fun TextToggleButton(
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
@@ -194,7 +194,10 @@
): TextButtonColors {
return textButtonColors(
containerColor = containerColor,
- contentColor = contentColor
+ contentColor = contentColor,
+ disabledContainerColor = MaterialTheme.colorScheme.onSurface.toDisabledColor(
+ disabledAlpha = DisabledContainerAlpha
+ ),
)
}
@@ -217,7 +220,10 @@
): TextButtonColors {
return textButtonColors(
containerColor = containerColor,
- contentColor = contentColor
+ contentColor = contentColor,
+ disabledContainerColor = MaterialTheme.colorScheme.onSurface.toDisabledColor(
+ disabledAlpha = DisabledContainerAlpha
+ ),
)
}
@@ -256,9 +262,7 @@
fun textButtonColors(
containerColor: Color = Color.Transparent,
contentColor: Color = MaterialTheme.colorScheme.onBackground,
- disabledContainerColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor(
- disabledAlpha = DisabledBorderAndContainerAlpha
- ),
+ disabledContainerColor: Color = Color.Transparent,
disabledContentColor: Color = MaterialTheme.colorScheme.onSurface.toDisabledColor()
): TextButtonColors = TextButtonColors(
containerColor = containerColor,
@@ -291,7 +295,7 @@
* unchecked and not enabled
*/
@Composable
- public fun textToggleButtonColors(
+ fun textToggleButtonColors(
checkedContainerColor: Color = MaterialTheme.colorScheme.primary,
checkedContentColor: Color = MaterialTheme.colorScheme.onPrimary,
uncheckedContainerColor: Color = MaterialTheme.colorScheme.surface,