Skip to content

Commit

Permalink
fix: #86
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jan 28, 2024
1 parent 3e1bada commit 76d668b
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions material/src/main/java/com/m3u/material/components/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.m3u.material.ktx.TelevisionChain
import com.m3u.material.ktx.isTelevision
import androidx.tv.material3.ListItem as TvListItem
Expand All @@ -42,7 +43,7 @@ fun Preference(
modifier: Modifier = Modifier,
enabled: Boolean = true,
content: String? = null,
elevation: Dp = Dp.Unspecified,
elevation: Dp = 0.dp,
onClick: () -> Unit = {},
icon: ImageVector? = null,
trailing: @Composable (() -> Unit)? = null
Expand All @@ -64,16 +65,6 @@ fun Preference(
}
) {
val alpha = if (enabled) 1f else 0.38f
// val currentContainerColor by animateColorAsState(
// targetValue = MaterialTheme.colorScheme.surface.copy(alpha),
// label = "preference-container-color",
// animationSpec = spring(stiffness = Spring.StiffnessMediumLow)
// )
// val currentContentColor by animateColorAsState(
// targetValue = MaterialTheme.colorScheme.onSurface.copy(alpha),
// label = "preference-content-color",
// animationSpec = spring(stiffness = Spring.StiffnessMediumLow)
// )
if (!isTelevision()) {
ListItem(
headlineContent = {
Expand Down Expand Up @@ -103,14 +94,6 @@ fun Preference(
}
},
tonalElevation = LocalAbsoluteTonalElevation.current,
// colors = ListItemDefaults.colors(
// containerColor = currentContainerColor,
// headlineColor = currentContentColor,
// leadingIconColor = currentContentColor,
// overlineColor = currentContentColor,
// supportingColor = currentContentColor,
// trailingIconColor = currentContentColor,
// ),
shadowElevation = elevation,
modifier = modifier
.semantics(mergeDescendants = true) {}
Expand Down Expand Up @@ -172,7 +155,7 @@ fun CheckBoxPreference(
onChanged: (Boolean) -> Unit,
modifier: Modifier = Modifier,
content: String? = null,
elevation: Dp = Dp.Unspecified,
elevation: Dp = 0.dp,
enabled: Boolean = true,
icon: ImageVector? = null,
) {
Expand Down Expand Up @@ -213,7 +196,7 @@ fun SwitchPreference(
onChanged: (Boolean) -> Unit,
modifier: Modifier = Modifier,
content: String? = null,
elevation: Dp = Dp.Unspecified,
elevation: Dp = 0.dp,
enabled: Boolean = true,
icon: ImageVector? = null,
) {
Expand Down Expand Up @@ -261,7 +244,7 @@ fun IconPreference(
onClick: () -> Unit,
modifier: Modifier = Modifier,
content: String? = null,
elevation: Dp = Dp.Unspecified,
elevation: Dp = 0.dp,
enabled: Boolean = true,
icon: ImageVector? = null,
) {
Expand Down Expand Up @@ -297,7 +280,7 @@ fun TextPreference(
onClick: () -> Unit,
modifier: Modifier = Modifier,
content: String? = null,
elevation: Dp = Dp.Unspecified,
elevation: Dp = 0.dp,
enabled: Boolean = true,
icon: ImageVector? = null,
) {
Expand Down

0 comments on commit 76d668b

Please sign in to comment.