-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/skill-desc' into 'master'
Add compendium info to EditTalentDialog and EditSkillDialog See merge request fmasa/wfrp-master!194
- Loading branch information
Showing
13 changed files
with
252 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 18 additions & 7 deletions
25
app/src/main/java/cz/muni/fi/rpg/ui/character/skills/dialog/EditSkillDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
app/src/main/java/cz/muni/fi/rpg/ui/character/skills/dialog/SkillDetail.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package cz.muni.fi.rpg.ui.character.skills.dialog | ||
|
||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material.Scaffold | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.TopAppBar | ||
import androidx.compose.runtime.* | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import cz.frantisekmasa.wfrp_master.core.ui.buttons.CloseButton | ||
import cz.frantisekmasa.wfrp_master.core.ui.primitives.NumberPicker | ||
import cz.frantisekmasa.wfrp_master.core.ui.primitives.SingleLineTextValue | ||
import cz.frantisekmasa.wfrp_master.core.ui.primitives.Spacing | ||
import cz.frantisekmasa.wfrp_master.core.ui.scaffolding.SubheadBar | ||
import cz.muni.fi.rpg.R | ||
import cz.muni.fi.rpg.model.domain.skills.Skill | ||
|
||
@Composable | ||
fun SkillDetail( | ||
skill: Skill, | ||
onDismissRequest: () -> Unit, | ||
onAdvancesChange: (advances: Int) -> Unit | ||
) { | ||
Scaffold( | ||
topBar = { | ||
TopAppBar( | ||
navigationIcon = { CloseButton(onDismissRequest) }, | ||
title = { Text(skill.name) }, | ||
) | ||
} | ||
) { | ||
Column(Modifier.verticalScroll(rememberScrollState())) { | ||
AdvancesBar(skill.advances, onAdvancesChange) | ||
|
||
Column(Modifier.padding(Spacing.bodyPadding)) { | ||
SingleLineTextValue( | ||
R.string.label_skill_characteristic, | ||
stringResource(skill.characteristic.getNameId()), | ||
) | ||
|
||
SingleLineTextValue( | ||
labelRes = R.string.label_skill_advanced, | ||
value = stringResource( | ||
if (skill.advanced) R.string.boolean_yes else R.string.boolean_no | ||
) | ||
) | ||
|
||
Text( | ||
text = skill.description, | ||
modifier = Modifier.padding(top = 8.dp), | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun AdvancesBar(advances: Int, onAdvancesChange: (advances: Int) -> Unit) { | ||
SubheadBar { | ||
Row( | ||
Modifier.fillMaxWidth(), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
Text(stringResource(R.string.label_advances)) | ||
NumberPicker( | ||
value = advances, | ||
onIncrement = { onAdvancesChange(advances + 1) }, | ||
onDecrement = { | ||
if (advances > 1) { | ||
onAdvancesChange(advances - 1) | ||
} | ||
} | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.