Fix some issues with desktop Linux

This commit is contained in:
William Brawner 2024-07-14 20:32:36 -06:00
parent 5df9a77714
commit a7d0119250
Signed by: wbrawner
GPG key ID: 8FF12381C6C90D35
5 changed files with 14 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.window.Tray
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.isTraySupported
import androidx.compose.ui.window.rememberTrayState
import com.wbrawner.pihelper.shared.*
import com.wbrawner.pihelper.shared.State
@ -121,11 +122,15 @@ fun main() = application {
}
)
if (isOpen) {
if (!isTraySupported || isOpen) {
Window(
title = "Pi-helper",
onCloseRequest = {
isOpen = false
if (isTraySupported) {
isOpen = false
} else {
exitApplication()
}
}) {
App(state)
}

View file

@ -19,7 +19,3 @@ android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
org.jetbrains.compose.experimental.uikit.enabled=true

View file

@ -4,13 +4,13 @@ androidx-appcompat = "1.6.1"
androidx-splash = "1.0.1"
androidx-test-runner = "1.5.2"
androidx-test-orchestrator = "1.4.2"
compose = "1.5.0"
compose = "1.6.0"
compose-compiler = "1.4.2"
compose-material = "1.5.0"
compose-material3 = "1.1.1"
espresso = "3.5.1"
hilt-android = "2.44"
kotlin = "1.9.10"
kotlin = "1.9.22"
kotlinx-serialization = "1.4.1"
kotlinx-coroutines = "1.6.4"
kotlinx-datetime = "0.4.0"
@ -36,7 +36,7 @@ compose-activity = { module = "androidx.activity:activity-compose", version = "1
compose-material = { module = "androidx.compose.material:material", version.ref = "compose-material" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
compose-material3-window = { module = "androidx.compose.material3:material3-window-size-class", version.ref = "compose-material3" }
compose-plugin-jetbrains = { module = "org.jetbrains.compose:compose-gradle-plugin", version = "1.5.0-rc04" }
compose-plugin-jetbrains = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "compose" }
compose-test-junit = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
compose-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" }
compose-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip

View file

@ -8,6 +8,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.ColorFilter
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource
@ -26,7 +27,7 @@ fun LoadingSpinner(animate: Boolean = false) {
)
Image(
modifier = Modifier.rotate(if (animate) rotation else 0f),
painter = painterResource("img/ic_app_logo.xml"),
painter = painterResource(DrawableResource("img/ic_app_logo.xml")),
contentDescription = "Loading",
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground)
)