From 7dd810aa52509957b8095fd66afa1ac2c5b74992 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Wed, 4 Aug 2021 13:54:38 +0300 Subject: [PATCH] Update README.md --- tutorials/Window_API_new/README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tutorials/Window_API_new/README.md b/tutorials/Window_API_new/README.md index e1b6f08892..bb1775479d 100644 --- a/tutorials/Window_API_new/README.md +++ b/tutorials/Window_API_new/README.md @@ -44,7 +44,7 @@ fun main() = application { } } ``` -![](window_properties.gif) + You can also close/open windows using a simple `if` statement. @@ -80,7 +80,7 @@ fun main() = application { } } ``` -![](window_splash.gif) + If the window requires some custom logic on close (for example, to show a dialog), you can override the close action using `onCloseRequest`. @@ -120,7 +120,7 @@ fun main() = application { } } ``` -![](ask_to_close.gif) + If you don't need to close the window and just need to hide it (for example to the tray), you can change the `windowState.isVisible` state: ```kotlin @@ -177,7 +177,7 @@ object TrayIcon : Painter() { } } ``` -![](hide_instead_of_close.gif) + If an application has multiple windows, then it is better to put its state into a separate class and open/close window in response to `mutableStateListOf` changes (see [notepad example](https://github.com/JetBrains/compose-jb/tree/master/examples/notepad) for more complex use cases): ```kotlin @@ -246,7 +246,7 @@ private class MyWindowState( fun close() = close(this) } ``` -![](multiple_windows.gif) + ## Function `singleWindowApplication` @@ -298,7 +298,7 @@ fun main() = application { } } ``` -![](adaptive.png) + ## Changing the state (maximized, minimized, fullscreen, size, position) of the window. @@ -378,7 +378,7 @@ fun main() = application { } } ``` -![](state.gif) + ## Listening the state of the window Reading the state in composition is useful when you need to update UI, but there are cases when you need to react to the state changes and send a value to another non-composable level of your application (write it to the database, for example): @@ -605,4 +605,5 @@ private fun WindowScope.AppWindowTitleBar() = WindowDraggableArea { Box(Modifier.fillMaxWidth().height(48.dp).background(Color.DarkGray)) } ``` + ![](draggable_area.gif)