Browse Source

Examples. Notepad. Move to 0.5.0-build229

pull/845/head
Igor Demin 3 years ago
parent
commit
622d2c36bd
  1. 2
      examples/notepad/build.gradle.kts
  2. 3
      examples/notepad/src/main/kotlin/window/NotepadWindow.kt
  3. 7
      examples/notepad/src/main/kotlin/window/NotepadWindowState.kt

2
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 {

3
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
)
}

7
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() {

Loading…
Cancel
Save