Remove dependency on compose material 2 components
(cherry picked from commit fb9423028eb017c110cb805f2d0601e5b02e50f9)
This commit is contained in:
parent
c1bf53e28a
commit
54d5f9baaf
@ -155,7 +155,6 @@ dependencies {
|
|||||||
implementation(compose.activity)
|
implementation(compose.activity)
|
||||||
implementation(compose.foundation)
|
implementation(compose.foundation)
|
||||||
implementation(compose.material3.core)
|
implementation(compose.material3.core)
|
||||||
implementation(compose.material.core)
|
|
||||||
implementation(compose.material.icons)
|
implementation(compose.material.icons)
|
||||||
implementation(compose.animation)
|
implementation(compose.animation)
|
||||||
implementation(compose.animation.graphics)
|
implementation(compose.animation.graphics)
|
||||||
|
@ -19,9 +19,6 @@ ui-util = { module = "androidx.compose.ui:ui-util" }
|
|||||||
material3-core = { module = "androidx.compose.material3:material3" }
|
material3-core = { module = "androidx.compose.material3:material3" }
|
||||||
material-icons = { module = "androidx.compose.material:material-icons-extended" }
|
material-icons = { module = "androidx.compose.material:material-icons-extended" }
|
||||||
|
|
||||||
# Some components aren't available in Material3
|
|
||||||
material-core = { module = "androidx.compose.material:material" }
|
|
||||||
|
|
||||||
glance = "androidx.glance:glance-appwidget:1.0.0"
|
glance = "androidx.glance:glance-appwidget:1.0.0"
|
||||||
|
|
||||||
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
|
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
|
||||||
|
@ -24,7 +24,6 @@ dependencies {
|
|||||||
implementation(compose.activity)
|
implementation(compose.activity)
|
||||||
implementation(compose.foundation)
|
implementation(compose.foundation)
|
||||||
implementation(compose.material3.core)
|
implementation(compose.material3.core)
|
||||||
implementation(compose.material.core)
|
|
||||||
implementation(compose.material.icons)
|
implementation(compose.material.icons)
|
||||||
implementation(compose.animation)
|
implementation(compose.animation)
|
||||||
implementation(compose.animation.graphics)
|
implementation(compose.animation.graphics)
|
||||||
|
@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
import androidx.compose.foundation.lazy.grid.LazyGridScope
|
import androidx.compose.foundation.lazy.grid.LazyGridScope
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.material.ContentAlpha
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowDownward
|
import androidx.compose.material.icons.filled.ArrowDownward
|
||||||
import androidx.compose.material.icons.filled.ArrowUpward
|
import androidx.compose.material.icons.filled.ArrowUpward
|
||||||
@ -57,6 +56,8 @@ object SettingsItemsPaddings {
|
|||||||
val Vertical = 10.dp
|
val Vertical = 10.dp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const val DisabledContentAlpha = 0.38f
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HeadingItem(labelRes: StringResource) {
|
fun HeadingItem(labelRes: StringResource) {
|
||||||
HeadingItem(stringResource(labelRes))
|
HeadingItem(stringResource(labelRes))
|
||||||
@ -282,7 +283,7 @@ fun TriStateItem(
|
|||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.large),
|
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.large),
|
||||||
) {
|
) {
|
||||||
val stateAlpha = if (enabled && onClick != null) 1f else ContentAlpha.disabled
|
val stateAlpha = if (enabled && onClick != null) 1f else DisabledContentAlpha
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = when (state) {
|
imageVector = when (state) {
|
||||||
@ -295,7 +296,7 @@ fun TriStateItem(
|
|||||||
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
|
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
|
||||||
} else {
|
} else {
|
||||||
when (onClick) {
|
when (onClick) {
|
||||||
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = ContentAlpha.disabled)
|
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledContentAlpha)
|
||||||
else -> MaterialTheme.colorScheme.primary
|
else -> MaterialTheme.colorScheme.primary
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user