Skip to content

Commit

Permalink
Remove dependency on compose material 2 components
Browse files Browse the repository at this point in the history
  • Loading branch information
AntsyLich committed May 7, 2024
1 parent 8e9396a commit fb94230
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ dependencies {
implementation(compose.activity)
implementation(compose.foundation)
implementation(compose.material3.core)
implementation(compose.material.core)
implementation(compose.material.icons)
implementation(compose.animation)
implementation(compose.animation.graphics)
Expand Down
3 changes: 0 additions & 3 deletions gradle/compose.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ ui-util = { module = "androidx.compose.ui:ui-util" }
material3-core = { module = "androidx.compose.material3:material3" }
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"

accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
1 change: 0 additions & 1 deletion presentation-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies {
implementation(compose.activity)
implementation(compose.foundation)
implementation(compose.material3.core)
implementation(compose.material.core)
implementation(compose.material.icons)
implementation(compose.animation)
implementation(compose.animation.graphics)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.material.ContentAlpha
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDownward
import androidx.compose.material.icons.filled.ArrowUpward
Expand Down Expand Up @@ -56,6 +55,8 @@ object SettingsItemsPaddings {
val Vertical = 10.dp
}

private const val DisabledContentAlpha = 0.38f

@Composable
fun HeadingItem(labelRes: StringResource) {
HeadingItem(stringResource(labelRes))
Expand Down Expand Up @@ -278,7 +279,7 @@ fun TriStateItem(
verticalAlignment = Alignment.CenterVertically,
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(
imageVector = when (state) {
Expand All @@ -291,7 +292,7 @@ fun TriStateItem(
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
} else {
when (onClick) {
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = ContentAlpha.disabled)
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = DisabledContentAlpha)
else -> MaterialTheme.colorScheme.primary
}
},
Expand Down

0 comments on commit fb94230

Please sign in to comment.