ADD: info for mood

This commit is contained in:
webfussel 2025-08-01 19:11:27 +02:00
parent 7f467a414e
commit 26a5640987
5 changed files with 15 additions and 13 deletions

View file

@ -11,6 +11,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import de.webfussel.soulecho.mood.MoodSection import de.webfussel.soulecho.mood.MoodSection
import de.webfussel.soulecho.mood.MoodWithInfo
import de.webfussel.soulecho.mood.PossibleMood import de.webfussel.soulecho.mood.PossibleMood
import de.webfussel.soulecho.navigation.Drawer import de.webfussel.soulecho.navigation.Drawer
import de.webfussel.soulecho.ui.theme.SoulEchoTheme import de.webfussel.soulecho.ui.theme.SoulEchoTheme
@ -18,11 +19,11 @@ import de.webfussel.soulecho.ui.theme.SoulEchoTheme
@Composable @Composable
fun SoulEchoApp() { fun SoulEchoApp() {
var currentMood by remember { var currentMood by remember {
mutableStateOf(PossibleMood.HAPPY) mutableStateOf(MoodWithInfo(mood = PossibleMood.HAPPY, info = ""))
} }
SoulEchoTheme (currentTheme = currentMood) { SoulEchoTheme (currentTheme = currentMood.mood) {
Drawer ( Drawer (
currentMood = currentMood, currentMood = currentMood.mood,
) { ) {
MoodSection( MoodSection(
currentMood = currentMood, currentMood = currentMood,

View file

@ -43,7 +43,7 @@ import de.webfussel.soulecho.ui.theme.getColorForMood
@Composable @Composable
fun MoodChoice ( fun MoodChoice (
onDismiss: () -> Unit = {}, onDismiss: () -> Unit = {},
onConfirm: (PossibleMood) -> Unit = {}, onConfirm: (MoodWithInfo) -> Unit = {},
) { ) {
var selectedMood by remember { mutableStateOf(PossibleMood.HAPPY) } var selectedMood by remember { mutableStateOf(PossibleMood.HAPPY) }
var info by remember { mutableStateOf("") } var info by remember { mutableStateOf("") }
@ -111,7 +111,7 @@ fun MoodChoice (
TextButton(onClick = onDismiss) { TextButton(onClick = onDismiss) {
Text("Abbrechen", color = Color(0xFFAA0000)) Text("Abbrechen", color = Color(0xFFAA0000))
} }
TextButton(onClick = { onConfirm(selectedMood) }) { TextButton(onClick = { onConfirm(MoodWithInfo(mood = selectedMood, info = info)) }) {
Text("Bestätigen", color = Color(0xFF007AFF)) Text("Bestätigen", color = Color(0xFF007AFF))
} }
} }

View file

@ -22,6 +22,11 @@ data class Mood(
@DrawableRes val icon: Int @DrawableRes val icon: Int
) )
data class MoodWithInfo(
val mood: PossibleMood,
val info: String
)
object Moods { object Moods {
private val happy = Mood( private val happy = Mood(
label = "Glücklich", label = "Glücklich",

View file

@ -27,8 +27,8 @@ import de.webfussel.soulecho.R
@Composable @Composable
fun MoodSection( fun MoodSection(
currentMood: PossibleMood = PossibleMood.HAPPY, currentMood: MoodWithInfo = MoodWithInfo(mood = PossibleMood.HAPPY, info = ""),
onMoodChange: (PossibleMood) -> Unit = {} onMoodChange: (MoodWithInfo) -> Unit = {}
) { ) {
var dialogOpen by remember { mutableStateOf(false) } var dialogOpen by remember { mutableStateOf(false) }
val theme = MaterialTheme.colorScheme val theme = MaterialTheme.colorScheme
@ -38,7 +38,7 @@ fun MoodSection(
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) { ) {
val mood = getMoodById(currentMood) val mood = getMoodById(currentMood.mood)
Icon( Icon(
painter = painterResource(mood.icon), painter = painterResource(mood.icon),
contentDescription = "Mood", contentDescription = "Mood",
@ -47,7 +47,7 @@ fun MoodSection(
) )
Spacer(modifier = Modifier.size(16.dp)) Spacer(modifier = Modifier.size(16.dp))
Text(mood.label, fontWeight = FontWeight.Bold, fontSize = 32.sp) Text(mood.label, fontWeight = FontWeight.Bold, fontSize = 32.sp)
Text("Läuft jetzt nativ") Text(currentMood.info)
} }
FloatingActionButton( FloatingActionButton(
containerColor = theme.primary, containerColor = theme.primary,

View file

@ -13,8 +13,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material3.DrawerValue import androidx.compose.material3.DrawerValue
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@ -22,8 +20,6 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.NavigationDrawerItem
import androidx.compose.material3.NavigationDrawerItemDefaults
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text