change(room members): moderation sheet design updates
This commit is contained in:
@@ -92,12 +92,13 @@ private fun RoomMemberAsyncActions(
|
||||
TextFieldDialog(
|
||||
title = stringResource(R.string.screen_bottom_sheet_manage_room_member_kick_member_confirmation_title),
|
||||
submitText = stringResource(R.string.screen_bottom_sheet_manage_room_member_kick_member_confirmation_action),
|
||||
destructiveSubmit = true,
|
||||
minLines = 2,
|
||||
onSubmit = { reason ->
|
||||
state.eventSink(InternalRoomMemberModerationEvents.DoKickUser(reason = reason))
|
||||
},
|
||||
onDismissRequest = { state.eventSink(InternalRoomMemberModerationEvents.Reset) },
|
||||
placeholder = stringResource(id = CommonStrings.common_reason),
|
||||
label = stringResource(id = CommonStrings.common_reason),
|
||||
content = stringResource(R.string.screen_bottom_sheet_manage_room_member_kick_member_confirmation_description),
|
||||
value = "",
|
||||
)
|
||||
@@ -131,12 +132,13 @@ private fun RoomMemberAsyncActions(
|
||||
TextFieldDialog(
|
||||
title = stringResource(R.string.screen_bottom_sheet_manage_room_member_ban_member_confirmation_title),
|
||||
submitText = stringResource(R.string.screen_bottom_sheet_manage_room_member_ban_member_confirmation_action),
|
||||
destructiveSubmit = true,
|
||||
minLines = 2,
|
||||
onSubmit = { reason ->
|
||||
state.eventSink(InternalRoomMemberModerationEvents.DoBanUser(reason = reason))
|
||||
},
|
||||
onDismissRequest = { state.eventSink(InternalRoomMemberModerationEvents.Reset) },
|
||||
placeholder = stringResource(id = CommonStrings.common_reason),
|
||||
label = stringResource(id = CommonStrings.common_reason),
|
||||
content = stringResource(R.string.screen_bottom_sheet_manage_room_member_ban_member_confirmation_description),
|
||||
value = "",
|
||||
)
|
||||
@@ -169,6 +171,8 @@ private fun RoomMemberAsyncActions(
|
||||
TextFieldDialog(
|
||||
title = stringResource(R.string.screen_bottom_sheet_manage_room_member_unban_member_confirmation_title),
|
||||
submitText = stringResource(R.string.screen_bottom_sheet_manage_room_member_unban_member_confirmation_action),
|
||||
destructiveSubmit = true,
|
||||
minLines = 2,
|
||||
onSubmit = { reason ->
|
||||
val userDisplayName = selectedUser?.getBestName().orEmpty()
|
||||
asyncIndicatorState.enqueue {
|
||||
@@ -178,7 +182,6 @@ private fun RoomMemberAsyncActions(
|
||||
},
|
||||
onDismissRequest = { state.eventSink(InternalRoomMemberModerationEvents.Reset) },
|
||||
placeholder = stringResource(id = CommonStrings.common_reason),
|
||||
label = stringResource(id = CommonStrings.common_reason),
|
||||
content = stringResource(R.string.screen_bottom_sheet_manage_room_member_unban_member_confirmation_description),
|
||||
value = "",
|
||||
)
|
||||
|
||||
@@ -41,6 +41,7 @@ fun ListDialog(
|
||||
submitText: String = stringResource(CommonStrings.action_ok),
|
||||
enabled: Boolean = true,
|
||||
applyPaddingToContents: Boolean = true,
|
||||
destructiveSubmit: Boolean = false,
|
||||
listItems: LazyListScope.() -> Unit,
|
||||
) {
|
||||
val decoratedSubtitle: @Composable (() -> Unit)? = subtitle?.let {
|
||||
@@ -65,6 +66,7 @@ fun ListDialog(
|
||||
enabled = enabled,
|
||||
listItems = listItems,
|
||||
applyPaddingToContents = applyPaddingToContents,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -79,6 +81,7 @@ private fun ListDialogContent(
|
||||
title: String?,
|
||||
enabled: Boolean,
|
||||
applyPaddingToContents: Boolean,
|
||||
destructiveSubmit: Boolean,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
SimpleAlertDialogContent(
|
||||
@@ -90,6 +93,7 @@ private fun ListDialogContent(
|
||||
onSubmitClick = onSubmitClick,
|
||||
enabled = enabled,
|
||||
applyPaddingToContents = applyPaddingToContents,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
) {
|
||||
// No start padding if padding is already applied to the content
|
||||
val horizontalPadding = if (applyPaddingToContents) 0.dp else 8.dp
|
||||
@@ -120,6 +124,7 @@ internal fun ListDialogContentPreview() {
|
||||
cancelText = "Cancel",
|
||||
submitText = "Save",
|
||||
enabled = true,
|
||||
destructiveSubmit = false,
|
||||
applyPaddingToContents = true,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,11 +43,13 @@ fun TextFieldDialog(
|
||||
validation: (String?) -> Boolean = { true },
|
||||
onValidationErrorMessage: String? = null,
|
||||
autoSelectOnDisplay: Boolean = true,
|
||||
maxLines: Int = 1,
|
||||
minLines: Int = 1,
|
||||
maxLines: Int = minLines,
|
||||
content: String? = null,
|
||||
label: String? = null,
|
||||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
||||
submitText: String = stringResource(CommonStrings.action_ok),
|
||||
destructiveSubmit: Boolean = false,
|
||||
) {
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
var textFieldContents by rememberSaveable(stateSaver = TextFieldValue.Saver) {
|
||||
@@ -67,6 +69,7 @@ fun TextFieldDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
enabled = canSubmit,
|
||||
submitText = submitText,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
modifier = modifier,
|
||||
) {
|
||||
if (content != null) {
|
||||
@@ -93,6 +96,7 @@ fun TextFieldDialog(
|
||||
onSubmit(textFieldContents.text)
|
||||
}
|
||||
}),
|
||||
minLines = minLines,
|
||||
maxLines = maxLines,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@@ -26,7 +26,8 @@ fun TextFieldListItem(
|
||||
onTextChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
error: String? = null,
|
||||
maxLines: Int = 1,
|
||||
minLines: Int = 1,
|
||||
maxLines: Int = minLines,
|
||||
label: String? = null,
|
||||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
||||
@@ -53,7 +54,8 @@ fun TextFieldListItem(
|
||||
onTextChange: (TextFieldValue) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
error: String? = null,
|
||||
maxLines: Int = 1,
|
||||
minLines: Int = 1,
|
||||
maxLines: Int = minLines,
|
||||
label: String? = null,
|
||||
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
||||
@@ -68,6 +70,7 @@ fun TextFieldListItem(
|
||||
keyboardOptions = keyboardOptions,
|
||||
keyboardActions = keyboardActions,
|
||||
maxLines = maxLines,
|
||||
minLines = minLines,
|
||||
singleLine = maxLines == 1,
|
||||
modifier = modifier,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user