Add child destination in the mapdetail

This commit is contained in:
Thomas Andres Gomez 2023-11-10 16:54:13 +01:00
parent 50b0eb31d4
commit 0e85c343c0
4 changed files with 52 additions and 5 deletions

View file

@ -18,11 +18,14 @@ class WorldParser @Inject constructor() {
val child = line.parse(column = CHILD)
val x = line.parseFloat(column = X)
val y = line.parseFloat(column = Y)
if (child != null && x != null && y != null) {
if (child != null) {
val world = WorldDto(
parent = parent,
child = child,
position = Offset(x = x, y = y),
position = when {
x != null && y != null -> Offset(x = x, y = y)
else -> Offset.Unspecified
},
)
worlds.add(world)
}

View file

@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
@ -68,6 +69,7 @@ import com.pixelized.rplexicon.ui.composable.rememberBackgroundGradient
import com.pixelized.rplexicon.ui.navigation.LocalScreenNavHost
import com.pixelized.rplexicon.ui.navigation.screens.navigateToLocationDetail
import com.pixelized.rplexicon.ui.theme.LexiconTheme
import com.pixelized.rplexicon.utilitary.LOS_HOLLOW
import com.pixelized.rplexicon.utilitary.annotateWithDropCap
import com.pixelized.rplexicon.utilitary.extentions.lexicon
import kotlinx.coroutines.CoroutineScope
@ -359,12 +361,12 @@ private fun LocationContent(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = this@constraint.maxHeight)
.padding(all = 16.dp),
.padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(space = 24.dp),
) {
Text(
textAlign = TextAlign.Center,
modifier = Modifier.padding(horizontal = 16.dp),
style = MaterialTheme.typography.headlineSmall,
text = annotateWithDropCap(
text = item.value?.name ?: "",
@ -373,7 +375,9 @@ private fun LocationContent(
)
item.value?.description?.let {
Text(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
style = MaterialTheme.typography.bodyMedium,
text = annotateWithDropCap(
text = it,
@ -381,6 +385,44 @@ private fun LocationContent(
),
)
}
if (item.value?.marquees?.isNotEmpty() == true) {
Column {
Text(
modifier = Modifier
.padding(bottom = 8.dp)
.padding(horizontal = 16.dp),
style = MaterialTheme.typography.titleMedium,
text = annotateWithDropCap(
text = stringResource(id = R.string.map_destination),
style = MaterialTheme.lexicon.typography.titleMediumDropCap,
)
)
item.value?.marquees?.forEach {
Row(
modifier = Modifier
.clickable { onDestination(it) }
.minimumInteractiveComponentSize()
.fillMaxWidth()
.padding(horizontal = 16.dp),
horizontalArrangement = Arrangement.spacedBy(space = 8.dp),
) {
Text(
modifier = Modifier.alignByBaseline(),
style = MaterialTheme.typography.bodyMedium,
text = LOS_HOLLOW
)
Text(
modifier = Modifier.alignByBaseline(),
style = MaterialTheme.typography.bodyMedium,
text = annotateWithDropCap(
text = it.name,
style = MaterialTheme.lexicon.typography.bodyMediumDropCap,
)
)
}
}
}
}
}
}
}

View file

@ -88,6 +88,7 @@
<string name="map_title">Carte</string>
<string name="map_label">Coordonnées</string>
<string name="map_destination">Destinations :</string>
<string name="character_sheet_tab_proficiency">Talents</string>
<string name="character_sheet_tab_inventory">Inventaire</string>

View file

@ -88,6 +88,7 @@
<string name="map_title">Map</string>
<string name="map_label">Coordinates</string>
<string name="map_destination">Destinations:</string>
<string name="character_sheet_tab_proficiency">Proficiencies</string>
<string name="character_sheet_tab_inventory">Inventory</string>