Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package org.polyfrost.oneconfig.internal.ui.screens

import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand All @@ -25,10 +24,8 @@ import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import org.polyfrost.oneconfig.internal.ThemeConfig
import org.polyfrost.oneconfig.internal.ui.api.ConfigRegistry
import org.polyfrost.oneconfig.internal.ui.components.Text
import org.polyfrost.oneconfig.internal.ui.components.onClick
import org.polyfrost.oneconfig.internal.ui.components.rememberInteractionSource
import org.polyfrost.oneconfig.internal.ui.shell.ShellState
import org.polyfrost.oneconfig.internal.ui.themes.Accent
Expand Down Expand Up @@ -83,7 +80,10 @@ private fun ThemeCard(theme: UITheme) {
modifier = Modifier
.background(LocalTheme.current.modCardBackground, LocalTheme.current.backgroundShape)
.border(borderWidth, borderColor, LocalTheme.current.backgroundShape)
.onClick(interactionSource) { ThemeRegistry.activate(theme) }
.clickable(interactionSource, indication = null) {
// Use clickable because onClick always plays CLICK. ThemeRegistry.activate chooses CLICK or OPEN
ThemeRegistry.activate(theme)
}
.pointerHoverIcon(PointerIcon.Hand)
.padding(14.dp),
verticalArrangement = Arrangement.spacedBy(14.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.runtime.mutableStateOf
import org.polyfrost.oneconfig.api.config.v1.ConfigManager
import org.polyfrost.oneconfig.internal.ThemeConfig
import org.polyfrost.oneconfig.internal.ui.api.settings.BuiltinVisualizers
import org.polyfrost.oneconfig.internal.ui.sound.UiSoundEvent
import org.polyfrost.oneconfig.internal.ui.sound.UiSounds
import org.polyfrost.oneconfig.internal.ui.sound.UiSoundTheme

Expand Down Expand Up @@ -40,8 +41,12 @@ object ThemeRegistry {
ThemeConfig.activeTheme = theme.name
syncNotificationTheme(theme)
saveThemeToConfig()
if (previous != null && UiSoundTheme.of(previous) != UiSoundTheme.of(theme)) {
UiSounds.onSoundThemeChanged()
if (previous != null) {
if (UiSoundTheme.of(previous) != UiSoundTheme.of(theme)) {
UiSounds.onSoundThemeChanged()
} else {
UiSounds.play(UiSoundEvent.CLICK)
}
}
}

Expand Down
Loading