From 24ae1c0224bf06cec458b126aa501908742a9f10 Mon Sep 17 00:00:00 2001 From: akurasov Date: Fri, 1 Oct 2021 19:25:10 +0300 Subject: [PATCH 1/4] switch to latest compose jb --- compose/frameworks/support | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/frameworks/support b/compose/frameworks/support index 7c650696a2..d5d9bec40a 160000 --- a/compose/frameworks/support +++ b/compose/frameworks/support @@ -1 +1 @@ -Subproject commit 7c650696a232d5019754fdb00311544276bab78f +Subproject commit d5d9bec40a3492ecc7787894ef2539de798c6513 From fb27a552d95916b108dc8a8eedb95141cb0654dc Mon Sep 17 00:00:00 2001 From: akurasov Date: Wed, 6 Oct 2021 18:27:19 +0300 Subject: [PATCH 2/4] intermediate implementation of oel by publishing --- compose/gradle.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compose/gradle.properties b/compose/gradle.properties index 77d50db1fe..7bbe27e26d 100644 --- a/compose/gradle.properties +++ b/compose/gradle.properties @@ -3,4 +3,7 @@ org.gradle.daemon=true org.gradle.configureondemand=true org.gradle.parallel=true org.gradle.caching=true -org.gradle.vfs.watch=true \ No newline at end of file +org.gradle.vfs.watch=true +androidx.compose.multiplatformEnabled=true +androidx.compose.jsCompilerTestsEnabled=true +androidx.validateProjectStructure=false \ No newline at end of file From 291eef252ead8346381de36637bf7f5a47f0f3d1 Mon Sep 17 00:00:00 2001 From: akurasov Date: Thu, 7 Oct 2021 14:54:13 +0300 Subject: [PATCH 3/4] adopting latest compose branch --- compose/frameworks/support | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/frameworks/support b/compose/frameworks/support index d5d9bec40a..5a420a4cf4 160000 --- a/compose/frameworks/support +++ b/compose/frameworks/support @@ -1 +1 @@ -Subproject commit d5d9bec40a3492ecc7787894ef2539de798c6513 +Subproject commit 5a420a4cf4a52867f616ff08bcab5fc35504a149 From 064e3ed3d4d98cb35914913e41b8593d26abcaf9 Mon Sep 17 00:00:00 2001 From: akurasov Date: Thu, 7 Oct 2021 17:58:25 +0300 Subject: [PATCH 4/4] updating components and tutorials to latest Compose API --- .../jetbrains/compose/splitpane/demo/Main.kt | 74 +++++++++---------- .../compose/splitpane/DesktopSplitter.kt | 7 +- components/gradle.properties | 2 +- tutorials/Mouse_Events/README.md | 4 + tutorials/Window_API_new/README.md | 6 +- 5 files changed, 46 insertions(+), 47 deletions(-) diff --git a/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt b/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt index 4054da5b87..62e61a641b 100644 --- a/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt +++ b/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.input.pointer.PointerIcon -import androidx.compose.ui.input.pointer.pointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.unit.dp import androidx.compose.ui.window.singleWindowApplication import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi @@ -23,53 +23,51 @@ import java.awt.Cursor @OptIn(ExperimentalComposeUiApi::class) private fun Modifier.cursorForHorizontalResize(): Modifier = - pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) + pointerHoverIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) @OptIn(ExperimentalSplitPaneApi::class) fun main() = singleWindowApplication( title = "SplitPane demo" ) { MaterialTheme { - DesktopTheme { - val splitterState = rememberSplitPaneState() - val hSplitterState = rememberSplitPaneState() - HorizontalSplitPane( - splitPaneState = splitterState - ) { - first(20.dp) { - Box(Modifier.background(Color.Red).fillMaxSize()) - } - second(50.dp) { - VerticalSplitPane(splitPaneState = hSplitterState) { - first(50.dp) { - Box(Modifier.background(Color.Blue).fillMaxSize()) - } - second(20.dp) { - Box(Modifier.background(Color.Green).fillMaxSize()) - } - } - } - splitter { - visiblePart { - Box( - Modifier - .width(1.dp) - .fillMaxHeight() - .background(MaterialTheme.colors.background) - ) + val splitterState = rememberSplitPaneState() + val hSplitterState = rememberSplitPaneState() + HorizontalSplitPane( + splitPaneState = splitterState + ) { + first(20.dp) { + Box(Modifier.background(Color.Red).fillMaxSize()) + } + second(50.dp) { + VerticalSplitPane(splitPaneState = hSplitterState) { + first(50.dp) { + Box(Modifier.background(Color.Blue).fillMaxSize()) } - handle { - Box( - Modifier - .markAsHandle() - .cursorForHorizontalResize() - .background(SolidColor(Color.Gray), alpha = 0.50f) - .width(9.dp) - .fillMaxHeight() - ) + second(20.dp) { + Box(Modifier.background(Color.Green).fillMaxSize()) } } } + splitter { + visiblePart { + Box( + Modifier + .width(1.dp) + .fillMaxHeight() + .background(MaterialTheme.colors.background) + ) + } + handle { + Box( + Modifier + .markAsHandle() + .cursorForHorizontalResize() + .background(SolidColor(Color.Gray), alpha = 0.50f) + .width(9.dp) + .fillMaxHeight() + ) + } + } } } } \ No newline at end of file diff --git a/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt b/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt index ff4927c1a0..c0ae71f661 100644 --- a/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt +++ b/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt @@ -8,16 +8,13 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.input.pointer.PointerIcon -import androidx.compose.ui.input.pointer.consumeAllChanges -import androidx.compose.ui.input.pointer.pointerIcon -import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.input.pointer.* import androidx.compose.ui.unit.dp import java.awt.Cursor @OptIn(ExperimentalComposeUiApi::class) private fun Modifier.cursorForHorizontalResize(isHorizontal: Boolean): Modifier = - pointerIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR))) + pointerHoverIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR))) @Composable private fun DesktopSplitPaneSeparator( diff --git a/components/gradle.properties b/components/gradle.properties index 2bebda45ca..74d745f324 100644 --- a/components/gradle.properties +++ b/components/gradle.properties @@ -4,4 +4,4 @@ android.enableJetifier=true kotlin.code.style=official # __LATEST_COMPOSE_RELEASE_VERSION__ -compose.version=1.0.0-alpha4-build362 +compose.version=0.0.0-sync-2010-10-01-build393 diff --git a/tutorials/Mouse_Events/README.md b/tutorials/Mouse_Events/README.md index a23f18548e..c5f1d26c1d 100644 --- a/tutorials/Mouse_Events/README.md +++ b/tutorials/Mouse_Events/README.md @@ -78,11 +78,13 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.window.singleWindowApplication +@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { var color by remember { mutableStateOf(Color(0, 0, 0)) } Box( @@ -115,6 +117,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter @@ -123,6 +126,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.window.singleWindowApplication +@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { Column( Modifier.background(Color.White), diff --git a/tutorials/Window_API_new/README.md b/tutorials/Window_API_new/README.md index e04116a3fd..0ee87259ca 100644 --- a/tutorials/Window_API_new/README.md +++ b/tutorials/Window_API_new/README.md @@ -160,7 +160,7 @@ fun main() = application { if (!isVisible) { Tray( TrayIcon, - hint = "Counter", + tooltip = "Counter", onAction = { isVisible = true }, menu = { Item("Exit", onClick = ::exitApplication) @@ -386,9 +386,9 @@ Reading the state in composition is useful when you need to update UI, but there ```kotlin import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.snapshotFlow +import androidx.compose.ui.unit.DpSize import androidx.compose.ui.window.Window import androidx.compose.ui.window.WindowPosition -import androidx.compose.ui.window.WindowSize import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState import kotlinx.coroutines.flow.filterNot @@ -414,7 +414,7 @@ fun main() = application { } } -private fun onWindowResize(size: WindowSize) { +private fun onWindowResize(size: DpSize) { println("onWindowResize $size") }