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