From 41a094009d17eea9a3f236ad58ef0c81576fbfe0 Mon Sep 17 00:00:00 2001 From: Thomas Andres Gomez Date: Fri, 22 Dec 2023 14:36:31 +0100 Subject: [PATCH] change the hitpoint cell in the summary to a maxLabel. --- .../ui/screens/summary/SummaryFactory.kt | 3 +- .../summary/composable/common/SummaryRow.kt | 51 ++++++++++++++----- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryFactory.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryFactory.kt index a82b36c..f6dc356 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryFactory.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/SummaryFactory.kt @@ -184,13 +184,14 @@ class SummaryFactory @Inject constructor( val dexterity = sheet.dexterity + status[Property.DEXTERITY].sum - val hitPoint = label( + val hitPoint = maxLabel( label = fire?.hitPoint?.let { when (it.additional) { null, 0 -> "${it.value}" else -> "${it.value}+${it.additional}" } } ?: "?", + max = "${sheet.hitPoint}", ) val armorClass = label( label = "${sheet.armorClass + status[Property.ARMOR_CLASS].sum}", diff --git a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/common/SummaryRow.kt b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/common/SummaryRow.kt index 95661c6..337fcbd 100644 --- a/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/common/SummaryRow.kt +++ b/app/src/main/java/com/pixelized/rplexicon/ui/screens/summary/composable/common/SummaryRow.kt @@ -2,6 +2,7 @@ package com.pixelized.rplexicon.ui.screens.summary.composable.common import androidx.annotation.StringRes import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -108,18 +109,44 @@ fun SummaryRow( private fun SummaryRowPreview() { LexiconTheme { Surface { - SummaryRow( - row = remember { - SummaryRowUio( - label = R.string.character_sheet_proficiency_perception, - c1 = mutableStateOf(proficiency("+6", 1)), - c2 = mutableStateOf(proficiency("+2", 0)), - c3 = mutableStateOf(proficiency("+4", 1)), - c4 = mutableStateOf(proficiency("-1", 0)), - c5 = mutableStateOf(proficiency("-1", 0)), - ) - } - ) + Column { + SummaryRow( + row = remember { + SummaryRowUio( + label = R.string.character_sheet_stat_strength, + c1 = mutableStateOf(label("16")), + c2 = mutableStateOf(label("14")), + c3 = mutableStateOf(label("14")), + c4 = mutableStateOf(label("8")), + c5 = mutableStateOf(label("8")), + ) + } + ) + SummaryRow( + row = remember { + SummaryRowUio( + label = R.string.character_sheet_proficiency_perception, + c1 = mutableStateOf(proficiency("+6", 1)), + c2 = mutableStateOf(proficiency("+2", 0)), + c3 = mutableStateOf(proficiency("+4", 1)), + c4 = mutableStateOf(proficiency("-1", 0)), + c5 = mutableStateOf(proficiency("-1", 0)), + ) + } + ) + SummaryRow( + row = remember { + SummaryRowUio( + label = R.string.character_sheet_title_spell_slot_1, + c1 = mutableStateOf(none()), + c2 = mutableStateOf(maxLabel("4", "4")), + c3 = mutableStateOf(maxLabel("3", "3")), + c4 = mutableStateOf(none()), + c5 = mutableStateOf(maxLabel("4", "4")), + ) + } + ) + } } } } \ No newline at end of file