Skip to content

Commit

Permalink
Merge pull request #145 from fmasa/ui-polish
Browse files Browse the repository at this point in the history
Minor UI polish
  • Loading branch information
fmasa authored Aug 4, 2023
2 parents 52cef4b + 13ba4ba commit 5829f95
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ private fun RowScope.CoinInput(value: InputValue, label: String, validate: Boole
validate = validate,
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
maxLength = 4,
showCharacterCount = false,
placeholder = "0",
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ private fun CharacteristicInputs(
horizontalAlignment = Alignment.CenterHorizontally,
validate = validate,
maxLength = 3,
showCharacterCount = false,
placeholder = "0",
)

Expand All @@ -213,6 +214,7 @@ private fun CharacteristicInputs(
horizontalAlignment = Alignment.CenterHorizontally,
validate = validate,
maxLength = 3,
showCharacterCount = false,
placeholder = "0",
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ fun CareerSelectBox(
label = null,
onClick = { dialogOpened = true },
) {
Text(itemValue ?: LocalStrings.current.commonUi.itemNone)
Text(
itemValue ?: LocalStrings.current.commonUi.itemNone,
maxLines = 1,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fun SelectBoxToggle(
.padding(Spacing.medium),
horizontalArrangement = Arrangement.SpaceBetween,
) {
Row { content() }
Row(Modifier.weight(1f), content = content)
Icon(
Icons.Rounded.ExpandMore,
LocalStrings.current.commonUi.labelExpandSelectBox,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fun TextInput(
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
maxLength: Int = Int.MAX_VALUE,
showCharacterCount: Boolean = maxLength < Int.MAX_VALUE,
multiLine: Boolean = false,
placeholder: String? = null,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
Expand All @@ -88,6 +89,7 @@ fun TextInput(
horizontalAlignment = horizontalAlignment,
filters = filters,
modifier = modifier,
showCharacterCount = showCharacterCount,
rules = value.rules,
visualTransformation = visualTransformation,
)
Expand All @@ -104,6 +106,7 @@ private fun TextInput(
keyboardOptions: KeyboardOptions,
keyboardActions: KeyboardActions,
maxLength: Int = Int.MAX_VALUE,
showCharacterCount: Boolean,
multiLine: Boolean = false,
placeholder: String? = null,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
Expand Down Expand Up @@ -169,7 +172,7 @@ private fun TextInput(
}
}

if (maxLength < Int.MAX_VALUE || helperText.isNullOrBlank()) {
if (showCharacterCount || helperText.isNullOrBlank()) {
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Row {
if (!helperText.isNullOrBlank()) {
Expand All @@ -178,7 +181,7 @@ private fun TextInput(

Spacer(Modifier.weight(1f))

if (maxLength < Int.MAX_VALUE) {
if (showCharacterCount) {
Text(
"${value.length} / $maxLength",
style = MaterialTheme.typography.overline,
Expand Down

0 comments on commit 5829f95

Please sign in to comment.