Browse Source

Update README.md

pull/996/head
Igor Demin 3 years ago committed by GitHub
parent
commit
0dfba3df79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      tutorials/Window_API_new/README.md

28
tutorials/Window_API_new/README.md

@ -122,20 +122,6 @@ fun main() = application {
``` ```
![](ask_to_close.gif) ![](ask_to_close.gif)
There is a simplified function for creating a single window application:
```
import androidx.compose.ui.window.singleWindowApplication
fun main() = singleWindowApplication {
// Content
}
```
Use it if:
- your application has only one window
- you don't need custom closing logic
- you don't need to change the window parameters after it is already created
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: 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 ```kotlin
import androidx.compose.material.Text import androidx.compose.material.Text
@ -262,6 +248,20 @@ private class MyWindowState(
``` ```
![](multiple_windows.gif) ![](multiple_windows.gif)
## Function `singleWindowApplication`
There is a simplified function for creating a single window application:
```
import androidx.compose.ui.window.singleWindowApplication
fun main() = singleWindowApplication {
// Content
}
```
Use it if:
- your application has only one window
- you don't need custom closing logic
- you don't need to change the window parameters after it is already created
## Changing the state (maximized, minimized, fullscreen, size, position) of the window. ## Changing the state (maximized, minimized, fullscreen, size, position) of the window.
Some states of the native window are moved into a separate API class, `WindowState`. You can change its properties in callbacks or observe it in Composable's. Some states of the native window are moved into a separate API class, `WindowState`. You can change its properties in callbacks or observe it in Composable's.

Loading…
Cancel
Save