diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/navigation/HomeNavHost.kt b/app/src/main/java/com/pixelized/rplexicon/ui/navigation/HomeNavHost.kt index 81495f0..831f88a 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/navigation/HomeNavHost.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/navigation/HomeNavHost.kt @@ -76,9 +76,11 @@ fun HomeNavHost( Text(text = stringResource(id = R.string.app_name)) }, actions = { - IconButton(onClick = { screen.navigateToSummary() }) { + IconButton( + onClick = { screen.navigateToSummary() }, + ) { Icon( - painter = painterResource(id = R.drawable.ic_d20_24), + painter = painterResource(id = R.drawable.ic_crowned_skull_24), contentDescription = null, ) } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryScreen.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryScreen.kt index 7e21c23..5466728 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryScreen.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -59,6 +60,12 @@ fun SummaryScreen( refreshing = false, onRefresh = { }, ) + val extendAttribute = rememberSaveable { mutableStateOf(true) } + val extendCharacteristic = rememberSaveable { mutableStateOf(true) } + val extendSavingThrows = rememberSaveable { mutableStateOf(true) } + val extendProficiencies = rememberSaveable { mutableStateOf(true) } + val extendPassives = rememberSaveable { mutableStateOf(true) } + val extendSpells = rememberSaveable { mutableStateOf(true) } Surface( modifier = Modifier.fillMaxSize(), @@ -75,12 +82,24 @@ fun SummaryScreen( statistics = { StatisticSummary( summary = statisticsViewModel.summary, + extendAttribute = extendAttribute, + extendCharacteristic = extendCharacteristic, + extendSavingThrows = extendSavingThrows, + extendProficiencies = extendProficiencies, + extendPassives = extendPassives, + extendSpells = extendSpells, onClass = { screen.navigateToCharacterSheet(name = it.label) }, onDice = { statisticsViewModel.showDetail(dice = it) }, + onAttribute = { extendAttribute.value = it }, + onCharacteristic = { extendCharacteristic.value = it }, + onSavingThrows = { extendSavingThrows.value = it }, + onProficiencies = { extendProficiencies.value = it }, + onPassives = { extendPassives.value = it }, + onSpells = { extendSpells.value = it }, ) }, ) diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/AttributesSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/AttributesSummary.kt index eff2803..a53121f 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/AttributesSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/AttributesSummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CutCornerShape @@ -10,6 +12,8 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable +import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -36,6 +40,8 @@ data class AttributesSummaryUio( fun AttributesSummary( modifier: Modifier = Modifier, attributes: AttributesSummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -43,26 +49,33 @@ fun AttributesSummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(start = 8.dp, top = 4.dp, bottom = 4.dp) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = attributes.hp, - color = MaterialTheme.colorScheme.primary, - ) - SummaryRow( - row = attributes.ac, - ) - SummaryRow( - row = attributes.dc, - ) - SummaryRow( - row = attributes.initiative, - ) - SummaryRow( - row = attributes.speed, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = attributes.hp, + color = MaterialTheme.colorScheme.primary, + ) + SummaryRow( + row = attributes.ac, + ) + SummaryRow( + row = attributes.dc, + ) + SummaryRow( + row = attributes.initiative, + ) + SummaryRow( + row = attributes.speed, + ) + } + } Text( modifier = Modifier.padding(vertical = 4.dp), style = MaterialTheme.typography.labelSmall, @@ -78,7 +91,9 @@ private fun StatsSummaryPreview() { LexiconTheme { Surface { AttributesSummary( - attributes = rememberAttributesSummary() + attributes = rememberAttributesSummary(), + extended = remember { mutableStateOf(true) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/CharacteristicsSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/CharacteristicsSummary.kt index d109cc6..779e99d 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/CharacteristicsSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/CharacteristicsSummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding @@ -11,6 +13,8 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable +import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -39,6 +43,8 @@ fun CharacteristicsSummary( modifier: Modifier = Modifier, padding: PaddingValues = PaddingValues(start = 8.dp, top = 4.dp, bottom = 4.dp), characteristics: CharacteristicsSummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -46,28 +52,35 @@ fun CharacteristicsSummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(paddingValues = padding) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = characteristics.strength, - ) - SummaryRow( - row = characteristics.dexterity, - ) - SummaryRow( - row = characteristics.constitution, - ) - SummaryRow( - row = characteristics.intelligence, - ) - SummaryRow( - row = characteristics.wisdom, - ) - SummaryRow( - row = characteristics.charisma, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = characteristics.strength, + ) + SummaryRow( + row = characteristics.dexterity, + ) + SummaryRow( + row = characteristics.constitution, + ) + SummaryRow( + row = characteristics.intelligence, + ) + SummaryRow( + row = characteristics.wisdom, + ) + SummaryRow( + row = characteristics.charisma, + ) + } + } Text( modifier = Modifier.padding(vertical = 4.dp), style = MaterialTheme.typography.labelSmall, @@ -84,6 +97,8 @@ private fun CharacteristicsSummaryPreview() { Surface { CharacteristicsSummary( characteristics = rememberCharacteristicsSummary(), + extended = remember { mutableStateOf(false) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/PassivesSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/PassivesSummary.kt index 5be7744..0392994 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/PassivesSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/PassivesSummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CutCornerShape @@ -10,6 +12,8 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable +import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -34,6 +38,8 @@ data class PassivesSummaryUio( fun PassivesSummary( modifier: Modifier = Modifier, passives: PassivesSummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -41,19 +47,26 @@ fun PassivesSummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(start = 8.dp, top = 4.dp, bottom = 4.dp) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = passives.perception, - ) - SummaryRow( - row = passives.investigation, - ) - SummaryRow( - row = passives.insight, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = passives.perception, + ) + SummaryRow( + row = passives.investigation, + ) + SummaryRow( + row = passives.insight, + ) + } + } Text( modifier = Modifier.padding(vertical = 4.dp), style = MaterialTheme.typography.labelSmall, @@ -70,6 +83,8 @@ private fun PassivesSummaryPreview() { Surface { PassivesSummary( passives = rememberPassivesSummary(), + extended = remember { mutableStateOf(true) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/ProficiencySummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/ProficiencySummary.kt index 3f3cb22..9242b81 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/ProficiencySummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/ProficiencySummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CutCornerShape @@ -10,6 +12,8 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable +import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -49,6 +53,8 @@ data class ProficiencySummaryUio( fun ProficiencySummary( modifier: Modifier = Modifier, proficiencies: ProficiencySummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -56,64 +62,71 @@ fun ProficiencySummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(start = 8.dp, top = 4.dp, bottom = 4.dp) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = proficiencies.acrobatics, - ) - SummaryRow( - row = proficiencies.arcana, - ) - SummaryRow( - row = proficiencies.athletics, - ) - SummaryRow( - row = proficiencies.stealth, - ) - SummaryRow( - row = proficiencies.animalHandling, - ) - SummaryRow( - row = proficiencies.sleightOfHand, - ) - SummaryRow( - row = proficiencies.history, - ) - SummaryRow( - row = proficiencies.intimidation, - ) - SummaryRow( - row = proficiencies.insight, - ) - SummaryRow( - row = proficiencies.investigation, - ) - SummaryRow( - row = proficiencies.medicine, - ) - SummaryRow( - row = proficiencies.nature, - ) - SummaryRow( - row = proficiencies.perception, - ) - SummaryRow( - row = proficiencies.persuasion, - ) - SummaryRow( - row = proficiencies.religion, - ) - SummaryRow( - row = proficiencies.performance, - ) - SummaryRow( - row = proficiencies.survival, - ) - SummaryRow( - row = proficiencies.deception, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = proficiencies.acrobatics, + ) + SummaryRow( + row = proficiencies.arcana, + ) + SummaryRow( + row = proficiencies.athletics, + ) + SummaryRow( + row = proficiencies.stealth, + ) + SummaryRow( + row = proficiencies.animalHandling, + ) + SummaryRow( + row = proficiencies.sleightOfHand, + ) + SummaryRow( + row = proficiencies.history, + ) + SummaryRow( + row = proficiencies.intimidation, + ) + SummaryRow( + row = proficiencies.insight, + ) + SummaryRow( + row = proficiencies.investigation, + ) + SummaryRow( + row = proficiencies.medicine, + ) + SummaryRow( + row = proficiencies.nature, + ) + SummaryRow( + row = proficiencies.perception, + ) + SummaryRow( + row = proficiencies.persuasion, + ) + SummaryRow( + row = proficiencies.religion, + ) + SummaryRow( + row = proficiencies.performance, + ) + SummaryRow( + row = proficiencies.survival, + ) + SummaryRow( + row = proficiencies.deception, + ) + } + } Text( modifier = Modifier.padding(vertical = 4.dp), style = MaterialTheme.typography.labelSmall, @@ -130,6 +143,8 @@ private fun ProficiencySummaryPreview() { Surface { ProficiencySummary( proficiencies = rememberProficienciesSummary(), + extended = remember { mutableStateOf(true) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SavingThrowsSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SavingThrowsSummary.kt index 3f3edda..e167589 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SavingThrowsSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SavingThrowsSummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CutCornerShape @@ -10,6 +12,8 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable +import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -36,7 +40,9 @@ data class SavingThrowsSummaryUio( @Composable fun SavingThrowsSummary( modifier: Modifier = Modifier, - savingThrows: SavingThrowsSummaryUio + savingThrows: SavingThrowsSummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -44,28 +50,35 @@ fun SavingThrowsSummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(start = 8.dp, top = 4.dp, bottom = 4.dp) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = savingThrows.strength, - ) - SummaryRow( - row = savingThrows.dexterity, - ) - SummaryRow( - row = savingThrows.constitution, - ) - SummaryRow( - row = savingThrows.intelligence, - ) - SummaryRow( - row = savingThrows.wisdom, - ) - SummaryRow( - row = savingThrows.charisma, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = savingThrows.strength, + ) + SummaryRow( + row = savingThrows.dexterity, + ) + SummaryRow( + row = savingThrows.constitution, + ) + SummaryRow( + row = savingThrows.intelligence, + ) + SummaryRow( + row = savingThrows.wisdom, + ) + SummaryRow( + row = savingThrows.charisma, + ) + } + } Text( modifier = Modifier.padding(vertical = 4.dp), style = MaterialTheme.typography.labelSmall, @@ -82,6 +95,8 @@ private fun SavingThrowsSummaryPreview() { Surface { SavingThrowsSummary( savingThrows = rememberSavingThrowsSummary(), + extended = remember { mutableStateOf(true) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SpellSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SpellSummary.kt index f800e7f..12754b8 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SpellSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/SpellSummary.kt @@ -1,6 +1,8 @@ package com.pixelized.rplexicon.ui.screens.summary.composable import android.content.res.Configuration +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CutCornerShape @@ -11,6 +13,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -45,6 +48,8 @@ fun SpellSummary( modifier: Modifier = Modifier, color: Color = MaterialTheme.colorScheme.primary, spells: SpellSummaryUio, + extended: State, + onClick: () -> Unit, ) { Column( modifier = Modifier @@ -52,67 +57,74 @@ fun SpellSummary( inner = remember { RoundedCornerShape(size = 8.dp) }, outline = remember { CutCornerShape(size = 16.dp) }, ) + .clickable(onClick = onClick) .padding(start = 8.dp, top = 4.dp, bottom = 4.dp) .then(other = modifier), horizontalAlignment = Alignment.CenterHorizontally, ) { - SummaryRow( - row = spells.extra, - color = color, - ) - if (1 <= spells.max.value) { - SummaryRow( - row = spells.slot1, - color = color, - ) - } - if (2 <= spells.max.value) { - SummaryRow( - row = spells.slot2, - color = color, - ) - } - if (3 <= spells.max.value) { - SummaryRow( - row = spells.slot3, - color = color, - ) - } - if (4 <= spells.max.value) { - SummaryRow( - row = spells.slot4, - color = color, - ) - } - if (5 <= spells.max.value) { - SummaryRow( - row = spells.slot5, - color = color, - ) - } - if (6 <= spells.max.value) { - SummaryRow( - row = spells.slot6, - color = color, - ) - } - if (7 <= spells.max.value) { - SummaryRow( - row = spells.slot7, - color = color, - ) - } - if (8 <= spells.max.value) { - SummaryRow( - row = spells.slot8, - color = color, - ) - } - if (9 <= spells.max.value) { - SummaryRow( - row = spells.slot9, - color = color, - ) + AnimatedVisibility( + visible = extended.value, + ) { + Column { + SummaryRow( + row = spells.extra, + color = color, + ) + if (1 <= spells.max.value) { + SummaryRow( + row = spells.slot1, + color = color, + ) + } + if (2 <= spells.max.value) { + SummaryRow( + row = spells.slot2, + color = color, + ) + } + if (3 <= spells.max.value) { + SummaryRow( + row = spells.slot3, + color = color, + ) + } + if (4 <= spells.max.value) { + SummaryRow( + row = spells.slot4, + color = color, + ) + } + if (5 <= spells.max.value) { + SummaryRow( + row = spells.slot5, + color = color, + ) + } + if (6 <= spells.max.value) { + SummaryRow( + row = spells.slot6, + color = color, + ) + } + if (7 <= spells.max.value) { + SummaryRow( + row = spells.slot7, + color = color, + ) + } + if (8 <= spells.max.value) { + SummaryRow( + row = spells.slot8, + color = color, + ) + } + if (9 <= spells.max.value) { + SummaryRow( + row = spells.slot9, + color = color, + ) + } + } } Text( modifier = Modifier.padding(vertical = 4.dp), @@ -130,6 +142,8 @@ private fun SpellSummaryPreview() { Surface { SpellSummary( spells = rememberSpellsSummary(), + extended = remember { mutableStateOf(true) }, + onClick = { }, ) } } diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/pages/statistic/StatisticSummary.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/pages/statistic/StatisticSummary.kt index 3903a6c..b11c791 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/pages/statistic/StatisticSummary.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/pages/statistic/StatisticSummary.kt @@ -20,6 +20,7 @@ import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.Stable import androidx.compose.runtime.State +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Brush @@ -71,6 +72,18 @@ fun StatisticSummary( summary: StatisticSummaryUio, onClass: (ClassHeaderSummaryUio.Header) -> Unit, onDice: (ClassHeaderSummaryUio.Dice) -> Unit, + extendAttribute: State, + extendCharacteristic: State, + extendSavingThrows: State, + extendProficiencies: State, + extendPassives: State, + extendSpells: State, + onAttribute: (Boolean) -> Unit, + onCharacteristic: (Boolean) -> Unit, + onSavingThrows: (Boolean) -> Unit, + onProficiencies: (Boolean) -> Unit, + onPassives: (Boolean) -> Unit, + onSpells: (Boolean) -> Unit, ) { Column( modifier = Modifier @@ -103,7 +116,10 @@ fun StatisticSummary( enter = enterTransition(), ) { AttributesSummary( + modifier = Modifier.fillMaxWidth(), attributes = summary.attributes, + extended = extendAttribute, + onClick = { onAttribute(extendAttribute.value.not()) }, ) } AnimatedVisibility( @@ -111,7 +127,10 @@ fun StatisticSummary( enter = enterTransition(), ) { CharacteristicsSummary( + modifier = Modifier.fillMaxWidth(), characteristics = summary.characteristics, + extended = extendCharacteristic, + onClick = { onCharacteristic(extendCharacteristic.value.not()) }, ) } AnimatedVisibility( @@ -119,7 +138,10 @@ fun StatisticSummary( enter = enterTransition(), ) { SavingThrowsSummary( + modifier = Modifier.fillMaxWidth(), savingThrows = summary.savingThrows, + extended = extendSavingThrows, + onClick = { onSavingThrows(extendSavingThrows.value.not()) }, ) } AnimatedVisibility( @@ -127,7 +149,10 @@ fun StatisticSummary( enter = enterTransition(), ) { ProficiencySummary( + modifier = Modifier.fillMaxWidth(), proficiencies = summary.proficiencies, + extended = extendProficiencies, + onClick = { onProficiencies(extendProficiencies.value.not()) }, ) } AnimatedVisibility( @@ -135,7 +160,10 @@ fun StatisticSummary( enter = enterTransition(), ) { PassivesSummary( + modifier = Modifier.fillMaxWidth(), passives = summary.passives, + extended = extendPassives, + onClick = { onPassives(extendPassives.value.not()) }, ) } AnimatedVisibility( @@ -143,7 +171,10 @@ fun StatisticSummary( enter = enterTransition(), ) { SpellSummary( + modifier = Modifier.fillMaxWidth(), spells = summary.spells, + extended = extendSpells, + onClick = { onSpells(extendSpells.value.not()) }, ) } } @@ -154,7 +185,7 @@ fun StatisticSummary( private fun enterTransition( density: Density = LocalDensity.current, ): EnterTransition { - return fadeIn() + slideInVertically { with(density) { 24.dp.roundToPx() } } + return fadeIn() + slideInVertically { with(density) { 16.dp.roundToPx() } } } @Composable @@ -183,6 +214,18 @@ fun StatisticSummaryPreview() { summary = rememberStatisticSummary(), onClass = { }, onDice = { }, + extendAttribute = remember { mutableStateOf(true) }, + extendCharacteristic = remember { mutableStateOf(true) }, + extendSavingThrows = remember { mutableStateOf(true) }, + extendProficiencies = remember { mutableStateOf(true) }, + extendPassives = remember { mutableStateOf(true) }, + extendSpells = remember { mutableStateOf(true) }, + onAttribute = { }, + onCharacteristic = { }, + onSavingThrows = { }, + onProficiencies = { }, + onPassives = { }, + onSpells = { }, ) } } diff --git a/app/src/main/res/drawable/ic_crowned_skull_24.xml b/app/src/main/res/drawable/ic_crowned_skull_24.xml new file mode 100644 index 0000000..9189385 --- /dev/null +++ b/app/src/main/res/drawable/ic_crowned_skull_24.xml @@ -0,0 +1,9 @@ + + +