Update Compose

Fixes #7004
This commit is contained in:
arkon 2022-05-11 22:29:28 -04:00
parent c7707dc50e
commit 393fc14630
4 changed files with 17 additions and 18 deletions

View file

@ -62,7 +62,7 @@ fun PreferenceRow(
Icon( Icon(
painter = painter, painter = painter,
modifier = Modifier modifier = Modifier
.padding(horizontal = horizontalPadding) .padding(start = horizontalPadding, end = 16.dp)
.size(24.dp), .size(24.dp),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,
contentDescription = null, contentDescription = null,
@ -70,7 +70,7 @@ fun PreferenceRow(
} }
Column( Column(
Modifier Modifier
.padding(horizontal = horizontalPadding) .padding(horizontal = 16.dp)
.weight(1f), .weight(1f),
) { ) {
Text( Text(
@ -86,7 +86,11 @@ fun PreferenceRow(
} }
} }
if (action != null) { if (action != null) {
Box(Modifier.widthIn(min = 56.dp)) { Box(
Modifier
.widthIn(min = 56.dp)
.padding(end = horizontalPadding),
) {
action() action()
} }
} }
@ -106,11 +110,7 @@ fun SwitchPreference(
title = title, title = title,
subtitle = subtitle, subtitle = subtitle,
painter = painter, painter = painter,
action = { action = { Switch(checked = preference.value, onCheckedChange = null) },
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())
},
onClick = { preference.value = !preference.value }, onClick = { preference.value = !preference.value },
) )
} }

View file

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

View file

@ -1,6 +1,6 @@
[versions] [versions]
compose = "1.2.0-alpha08" compose = "1.2.0-beta01"
accompanist = "0.24.7-alpha" accompanist = "0.24.8-beta"
[libraries] [libraries]
activity = "androidx.activity:activity-compose:1.6.0-alpha03" 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" } animation = { module = "androidx.compose.animation:animation", version.ref="compose" }
ui-tooling = { module = "androidx.compose.ui:ui-tooling", 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-core = "androidx.compose.material3:material3:1.0.0-alpha11"
material3-adapter = "com.google.android.material:compose-theme-adapter-3:1.0.8" 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" } material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref="compose" }
accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version.ref="accompanist" } accompanist-webview = { module = "com.google.accompanist:accompanist-webview", version.ref="accompanist" }

View file

@ -1,5 +1,5 @@
[versions] [versions]
kotlin_version = "1.6.20" kotlin_version = "1.6.21"
coroutines_version = "1.6.1" coroutines_version = "1.6.1"
serialization_version = "1.3.2" serialization_version = "1.3.2"
@ -16,8 +16,7 @@ serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", v
[bundles] [bundles]
coroutines = ["coroutines-core", "coroutines-android"] coroutines = ["coroutines-core", "coroutines-android"]
serialization = ["serialization-json","serialization-protobuf"] serialization = ["serialization-json", "serialization-protobuf"]
[plugins] [plugins]
android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version"} android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version"}