feat(join by alias) : add TextFieldValidity.None instead of nullable
This commit is contained in:
parent
3bb61757ca
commit
30fbb124a5
5 changed files with 6 additions and 5 deletions
|
|
@ -107,7 +107,7 @@ private fun RoomAddressField(
|
||||||
RoomAddressState.Unknown, RoomAddressState.Resolving -> stringResource(R.string.screen_start_chat_join_room_by_address_supporting_text)
|
RoomAddressState.Unknown, RoomAddressState.Resolving -> stringResource(R.string.screen_start_chat_join_room_by_address_supporting_text)
|
||||||
},
|
},
|
||||||
validity = when (addressState) {
|
validity = when (addressState) {
|
||||||
RoomAddressState.Unknown, RoomAddressState.Resolving -> null
|
RoomAddressState.Unknown, RoomAddressState.Resolving -> TextFieldValidity.None
|
||||||
RoomAddressState.Invalid, RoomAddressState.RoomNotFound -> TextFieldValidity.Invalid
|
RoomAddressState.Invalid, RoomAddressState.RoomNotFound -> TextFieldValidity.Invalid
|
||||||
is RoomAddressState.RoomFound -> TextFieldValidity.Valid
|
is RoomAddressState.RoomFound -> TextFieldValidity.Valid
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ fun BugReportView(
|
||||||
keyboardController?.hide()
|
keyboardController?.hide()
|
||||||
}),
|
}),
|
||||||
minLines = 3,
|
minLines = 3,
|
||||||
validity = if (state.isDescriptionInError) TextFieldValidity.Invalid else null,
|
validity = if (state.isDescriptionInError) TextFieldValidity.Invalid else TextFieldValidity.None,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ private fun Content(text: String, onTextChange: (String) -> Unit, hasError: Bool
|
||||||
Icon(imageVector = image, description)
|
Icon(imageVector = image, description)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
validity = if (hasError) TextFieldValidity.Invalid else null,
|
validity = if (hasError) TextFieldValidity.Invalid else TextFieldValidity.None,
|
||||||
supportingText = if (hasError) {
|
supportingText = if (hasError) {
|
||||||
stringResource(R.string.screen_reset_encryption_password_error)
|
stringResource(R.string.screen_reset_encryption_password_error)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ fun TextField(
|
||||||
placeholder: String? = null,
|
placeholder: String? = null,
|
||||||
leadingIcon: @Composable (() -> Unit)? = null,
|
leadingIcon: @Composable (() -> Unit)? = null,
|
||||||
trailingIcon: @Composable (() -> Unit)? = null,
|
trailingIcon: @Composable (() -> Unit)? = null,
|
||||||
validity: TextFieldValidity? = null,
|
validity: TextFieldValidity = TextFieldValidity.None,
|
||||||
enabled: Boolean = true,
|
enabled: Boolean = true,
|
||||||
readOnly: Boolean = false,
|
readOnly: Boolean = false,
|
||||||
singleLine: Boolean = false,
|
singleLine: Boolean = false,
|
||||||
|
|
@ -288,6 +288,7 @@ private fun SupportingTextLayout(validity: TextFieldValidity?, supportingText: S
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class TextFieldValidity {
|
enum class TextFieldValidity {
|
||||||
|
None,
|
||||||
Invalid,
|
Invalid,
|
||||||
Valid
|
Valid
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ fun RoomAddressField(
|
||||||
},
|
},
|
||||||
validity = when (addressValidity) {
|
validity = when (addressValidity) {
|
||||||
RoomAddressValidity.InvalidSymbols, RoomAddressValidity.NotAvailable -> TextFieldValidity.Invalid
|
RoomAddressValidity.InvalidSymbols, RoomAddressValidity.NotAvailable -> TextFieldValidity.Invalid
|
||||||
else -> null
|
else -> TextFieldValidity.None
|
||||||
},
|
},
|
||||||
onValueChange = onAddressChange,
|
onValueChange = onAddressChange,
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue