From 622d2c36bda970a5eb56af4a348962fba9eaf3de Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Mon, 5 Jul 2021 15:41:25 +0300 Subject: [PATCH] Examples. Notepad. Move to 0.5.0-build229 --- examples/notepad/build.gradle.kts | 2 +- examples/notepad/src/main/kotlin/window/NotepadWindow.kt | 3 ++- .../notepad/src/main/kotlin/window/NotepadWindowState.kt | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/notepad/build.gradle.kts b/examples/notepad/build.gradle.kts index 36a2a3adbf..9233ffc6e6 100644 --- a/examples/notepad/build.gradle.kts +++ b/examples/notepad/build.gradle.kts @@ -5,7 +5,7 @@ plugins { // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.5.10" // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.4.0") + id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.5.0-build229") } repositories { diff --git a/examples/notepad/src/main/kotlin/window/NotepadWindow.kt b/examples/notepad/src/main/kotlin/window/NotepadWindow.kt index 420739117c..dca895e5de 100644 --- a/examples/notepad/src/main/kotlin/window/NotepadWindow.kt +++ b/examples/notepad/src/main/kotlin/window/NotepadWindow.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.window.MenuBar import androidx.compose.ui.window.Notification import androidx.compose.ui.window.Window +import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowScope import common.LocalAppResources import kotlinx.coroutines.flow.collect @@ -118,7 +119,7 @@ private fun WindowScope.WindowMenuBar(state: NotepadWindowState) = MenuBar { onClick = state.settings::toggleTray ) Item( - if (state.window.isFullscreen) "Exit fullscreen" else "Enter fullscreen", + if (state.window.placement == WindowPlacement.Fullscreen) "Exit fullscreen" else "Enter fullscreen", onClick = state::toggleFullscreen ) } diff --git a/examples/notepad/src/main/kotlin/window/NotepadWindowState.kt b/examples/notepad/src/main/kotlin/window/NotepadWindowState.kt index 4c2ecfc3f4..8afee9ad37 100644 --- a/examples/notepad/src/main/kotlin/window/NotepadWindowState.kt +++ b/examples/notepad/src/main/kotlin/window/NotepadWindowState.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.ui.window.Notification +import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowState import common.Settings import kotlinx.coroutines.CompletableDeferred @@ -55,7 +56,11 @@ class NotepadWindowState( private set fun toggleFullscreen() { - window.isFullscreen = !window.isFullscreen + window.placement = if (window.placement == WindowPlacement.Fullscreen) { + WindowPlacement.Floating + } else { + WindowPlacement.Fullscreen + } } suspend fun run() {