From fb9423028eb017c110cb805f2d0601e5b02e50f9 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Tue, 7 May 2024 15:53:26 +0600 Subject: [PATCH] Remove dependency on compose material 2 components --- app/build.gradle.kts | 1 - gradle/compose.versions.toml | 3 --- presentation-core/build.gradle.kts | 1 - .../presentation/core/components/SettingsItems.kt | 7 ++++--- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5a16ab034..f7f9a78a3 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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) diff --git a/gradle/compose.versions.toml b/gradle/compose.versions.toml index 1249e384f..77a87adf1 100644 --- a/gradle/compose.versions.toml +++ b/gradle/compose.versions.toml @@ -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" } diff --git a/presentation-core/build.gradle.kts b/presentation-core/build.gradle.kts index c7b64ad42..8fca92019 100644 --- a/presentation-core/build.gradle.kts +++ b/presentation-core/build.gradle.kts @@ -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) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt index abdf61c9f..4fd4b7571 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt @@ -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 @@ -56,6 +55,8 @@ object SettingsItemsPaddings { val Vertical = 10.dp } +private const val DisabledContentAlpha = 0.38f + @Composable fun HeadingItem(labelRes: StringResource) { HeadingItem(stringResource(labelRes)) @@ -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) { @@ -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 } },