From 393fc146303c3dc6185842e4158c3bd3f006017b Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 11 May 2022 22:29:28 -0400 Subject: [PATCH] Update Compose Fixes #7004 --- .../presentation/components/Preferences.kt | 16 ++++++++-------- .../ui/base/controller/ComposeController.kt | 6 +++--- gradle/compose.versions.toml | 8 ++++---- gradle/kotlinx.versions.toml | 5 ++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/Preferences.kt b/app/src/main/java/eu/kanade/presentation/components/Preferences.kt index a0b6d64271..d50796d2cf 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Preferences.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Preferences.kt @@ -62,7 +62,7 @@ fun PreferenceRow( Icon( painter = painter, modifier = Modifier - .padding(horizontal = horizontalPadding) + .padding(start = horizontalPadding, end = 16.dp) .size(24.dp), tint = MaterialTheme.colorScheme.primary, contentDescription = null, @@ -70,7 +70,7 @@ fun PreferenceRow( } Column( Modifier - .padding(horizontal = horizontalPadding) + .padding(horizontal = 16.dp) .weight(1f), ) { Text( @@ -86,7 +86,11 @@ fun PreferenceRow( } } if (action != null) { - Box(Modifier.widthIn(min = 56.dp)) { + Box( + Modifier + .widthIn(min = 56.dp) + .padding(end = horizontalPadding), + ) { action() } } @@ -106,11 +110,7 @@ fun SwitchPreference( title = title, subtitle = subtitle, painter = painter, - action = { - Switch(checked = preference.value, onCheckedChange = null) - // TODO: remove this once switch checked state is fixed: https://issuetracker.google.com/issues/228336571 - Text(preference.value.toString()) - }, + action = { Switch(checked = preference.value, onCheckedChange = null) }, onClick = { preference.value = !preference.value }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt index 44f32c2446..431b906ae4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/controller/ComposeController.kt @@ -30,7 +30,7 @@ abstract class ComposeController

>(bundle: Bundle? = null) : consumeWindowInsets = false setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { - val nestedScrollInterop = rememberNestedScrollInteropConnection(binding.root) + val nestedScrollInterop = rememberNestedScrollInteropConnection() TachiyomiTheme { ComposeContent(nestedScrollInterop) } @@ -56,7 +56,7 @@ abstract class BasicComposeController : consumeWindowInsets = false setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { - val nestedScrollInterop = rememberNestedScrollInteropConnection(binding.root) + val nestedScrollInterop = rememberNestedScrollInteropConnection() TachiyomiTheme { ComposeContent(nestedScrollInterop) } @@ -79,7 +79,7 @@ abstract class SearchableComposeController

>(bundle: Bundle? consumeWindowInsets = false setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { - val nestedScrollInterop = rememberNestedScrollInteropConnection(binding.root) + val nestedScrollInterop = rememberNestedScrollInteropConnection() TachiyomiTheme { ComposeContent(nestedScrollInterop) } diff --git a/gradle/compose.versions.toml b/gradle/compose.versions.toml index a12284da5d..e97b9dacbe 100644 --- a/gradle/compose.versions.toml +++ b/gradle/compose.versions.toml @@ -1,6 +1,6 @@ [versions] -compose = "1.2.0-alpha08" -accompanist = "0.24.7-alpha" +compose = "1.2.0-beta01" +accompanist = "0.24.8-beta" [libraries] activity = "androidx.activity:activity-compose:1.6.0-alpha03" @@ -8,8 +8,8 @@ foundation = { module = "androidx.compose.foundation:foundation", version.ref="c animation = { module = "androidx.compose.animation:animation", version.ref="compose" } ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref="compose" } -material3-core = "androidx.compose.material3:material3:1.0.0-alpha10" -material3-adapter = "com.google.android.material:compose-theme-adapter-3:1.0.8" +material3-core = "androidx.compose.material3:material3:1.0.0-alpha11" +material3-adapter = "com.google.android.material:compose-theme-adapter-3:1.0.9" material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref="compose" } accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version.ref="accompanist" } \ No newline at end of file diff --git a/gradle/kotlinx.versions.toml b/gradle/kotlinx.versions.toml index 268e66b5f4..52397ac608 100644 --- a/gradle/kotlinx.versions.toml +++ b/gradle/kotlinx.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin_version = "1.6.20" +kotlin_version = "1.6.21" coroutines_version = "1.6.1" serialization_version = "1.3.2" @@ -16,8 +16,7 @@ serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", v [bundles] coroutines = ["coroutines-core", "coroutines-android"] -serialization = ["serialization-json","serialization-protobuf"] +serialization = ["serialization-json", "serialization-protobuf"] [plugins] - android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version"} \ No newline at end of file