Fix deprecation warning on androidx.compose.material3.ListItem

This commit is contained in:
Benoit Marty
2026-07-09 16:19:44 +02:00
committed by Benoit Marty
parent d2b4a85453
commit d1cf1aa09f
56 changed files with 205 additions and 206 deletions
@@ -39,7 +39,7 @@ fun AnalyticsPreferencesView(
) )
Column(modifier) { Column(modifier) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_analytics_settings_share_data)) Text(stringResource(id = R.string.screen_analytics_settings_share_data))
}, },
supportingContent = { supportingContent = {
@@ -312,7 +312,7 @@ private fun RoomJoinRuleOptions(
backgroundTint = Color.Transparent, backgroundTint = Color.Transparent,
) )
}, },
headlineContent = { content = {
val title = when (item) { val title = when (item) {
JoinRuleItem.PublicVisibility.Public -> stringResource(R.string.screen_create_room_room_access_section_public_option_title) JoinRuleItem.PublicVisibility.Public -> stringResource(R.string.screen_create_room_room_access_section_public_option_title)
is JoinRuleItem.PrivateVisibility.Restricted -> stringResource(R.string.screen_create_room_room_access_section_restricted_option_title) is JoinRuleItem.PrivateVisibility.Restricted -> stringResource(R.string.screen_create_room_room_access_section_restricted_option_title)
@@ -58,7 +58,7 @@ internal fun SelectParentSpaceOptions(
modifier = modifier modifier = modifier
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = selectedSpace?.displayName text = selectedSpace?.displayName
?: stringResource(R.string.screen_create_room_space_selection_no_space_title), ?: stringResource(R.string.screen_create_room_space_selection_no_space_title),
@@ -126,7 +126,7 @@ private fun SelectParentSpaceBottomSheet(
LazyColumn(modifier = Modifier.fillMaxWidth()) { LazyColumn(modifier = Modifier.fillMaxWidth()) {
item { item {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(R.string.screen_create_room_space_selection_no_space_option), text = stringResource(R.string.screen_create_room_space_selection_no_space_option),
maxLines = 1 maxLines = 1
@@ -141,7 +141,7 @@ private fun SelectParentSpaceBottomSheet(
for (space in spaces) { for (space in spaces) {
item { item {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = space.displayName, text = space.displayName,
maxLines = 1 maxLines = 1
@@ -94,7 +94,7 @@ private fun RoomListModalBottomSheetContent(
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = contextMenu.roomName ?: stringResource(id = CommonStrings.common_no_room_name), text = contextMenu.roomName ?: stringResource(id = CommonStrings.common_no_room_name),
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
@@ -104,7 +104,7 @@ private fun RoomListModalBottomSheetContent(
) )
if (contextMenu.hasNewContent) { if (contextMenu.hasNewContent) {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = CommonStrings.action_mark_as_read), text = stringResource(id = CommonStrings.action_mark_as_read),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
@@ -117,7 +117,7 @@ private fun RoomListModalBottomSheetContent(
) )
} else { } else {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_roomlist_mark_as_unread), text = stringResource(id = R.string.screen_roomlist_mark_as_unread),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
@@ -135,7 +135,7 @@ private fun RoomListModalBottomSheetContent(
CommonStrings.common_favourite to CompoundIcons.Favourite() CommonStrings.common_favourite to CompoundIcons.Favourite()
} }
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = textResId), text = stringResource(id = textResId),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
@@ -154,7 +154,7 @@ private fun RoomListModalBottomSheetContent(
}, },
) )
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = CommonStrings.common_settings), text = stringResource(id = CommonStrings.common_settings),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
@@ -169,7 +169,7 @@ private fun RoomListModalBottomSheetContent(
) )
if (canReportRoom) { if (canReportRoom) {
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(CommonStrings.action_report_room)) Text(text = stringResource(CommonStrings.action_report_room))
}, },
modifier = Modifier.clickable { onReportRoomClick() }, modifier = Modifier.clickable { onReportRoomClick() },
@@ -182,7 +182,7 @@ private fun RoomListModalBottomSheetContent(
) )
} }
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(CommonStrings.action_leave_room)) Text(text = stringResource(CommonStrings.action_leave_room))
}, },
modifier = Modifier.clickable { onLeaveRoomClick() }, modifier = Modifier.clickable { onLeaveRoomClick() },
@@ -81,7 +81,7 @@ fun DeclineAndBlockView(
) { ) {
ListItem( ListItem(
modifier = Modifier.padding(end = 8.dp), modifier = Modifier.padding(end = 8.dp),
headlineContent = { content = {
Text(text = stringResource(R.string.screen_decline_and_block_block_user_option_title)) Text(text = stringResource(R.string.screen_decline_and_block_block_user_option_title))
}, },
supportingContent = { supportingContent = {
@@ -96,7 +96,7 @@ fun DeclineAndBlockView(
Spacer(modifier = Modifier.height(24.dp)) Spacer(modifier = Modifier.height(24.dp))
ListItem( ListItem(
modifier = Modifier.padding(end = 8.dp), modifier = Modifier.padding(end = 8.dp),
headlineContent = { content = {
Text(text = stringResource(CommonStrings.action_report_room)) Text(text = stringResource(CommonStrings.action_report_room))
}, },
supportingContent = { supportingContent = {
@@ -62,7 +62,7 @@ fun DependenciesDetailsView(
} }
} }
ListItem( ListItem(
headlineContent = { content = {
ClickableLinkText( ClickableLinkText(
text = text, text = text,
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
@@ -100,7 +100,7 @@ fun DependencyLicensesListView(
} }
is AsyncData.Success -> items(state.licenses.data) { license -> is AsyncData.Success -> items(state.licenses.data) { license ->
ListItem( ListItem(
headlineContent = { Text(license.safeName) }, content = { Text(license.safeName) },
supportingContent = { supportingContent = {
Text( Text(
buildString { buildString {
@@ -261,7 +261,7 @@ private fun ShareCurrentLocationItem(
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.screen_share_my_location_action)) Text(stringResource(CommonStrings.screen_share_my_location_action))
}, },
onClick = onClick, onClick = onClick,
@@ -276,7 +276,7 @@ private fun SharePinLocationItem(
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.screen_share_this_location_action)) Text(stringResource(CommonStrings.screen_share_this_location_action))
}, },
onClick = onClick, onClick = onClick,
@@ -291,7 +291,7 @@ private fun ShareLiveLocationItem(
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.action_share_live_location)) Text(stringResource(CommonStrings.action_share_live_location))
}, },
onClick = onClick, onClick = onClick,
@@ -38,7 +38,7 @@ fun LockScreenSettingsView(
) { ) {
PreferenceCategory(showTopDivider = false) { PreferenceCategory(showTopDivider = false) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_app_lock_settings_change_pin)) Text(stringResource(id = R.string.screen_app_lock_settings_change_pin))
}, },
onClick = onChangePinClick, onClick = onChangePinClick,
@@ -46,7 +46,7 @@ fun LockScreenSettingsView(
PreferenceDivider() PreferenceDivider()
if (state.showRemovePinOption) { if (state.showRemovePinOption) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_app_lock_settings_remove_pin)) Text(stringResource(id = R.string.screen_app_lock_settings_remove_pin))
}, },
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
@@ -248,7 +248,7 @@ private fun ActionListViewContent(
modifier = Modifier.clickable { modifier = Modifier.clickable {
onActionClick(action) onActionClick(action)
}, },
headlineContent = { content = {
Text(text = stringResource(id = action.titleRes)) Text(text = stringResource(id = action.titleRes))
}, },
leadingContent = ListItemContent.Icon(IconSource.Resource(action.icon)), leadingContent = ListItemContent.Icon(IconSource.Resource(action.icon)),
@@ -461,7 +461,7 @@ private fun VerifiedUserSendFailureView(
.padding(horizontal = 16.dp, vertical = 8.dp), .padding(horizontal = 16.dp, vertical = 8.dp),
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ErrorSolid())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ErrorSolid())),
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChevronRight())), trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChevronRight())),
headlineContent = { content = {
Text( Text(
text = sendFailure.headline(), text = sendFailure.headline(),
style = ElementTheme.typography.fontBodySmMedium, style = ElementTheme.typography.fontBodySmMedium,
@@ -494,7 +494,7 @@ private fun VideoQualitySelectorDialog(
val estimationMb = sizeFormatter.format(videoEstimation.sizeInBytes, true) val estimationMb = sizeFormatter.format(videoEstimation.sizeInBytes, true)
val title = "${preset.title()} ($estimationMb)" val title = "${preset.title()} ($estimationMb)"
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = title, text = title,
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
@@ -106,22 +106,22 @@ private fun AttachmentSourcePickerMenu(
ListItem( ListItem(
modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.PhotoFromCamera) }, modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.PhotoFromCamera) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.TakePhoto())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.TakePhoto())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_camera_photo)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_camera_photo)) },
) )
ListItem( ListItem(
modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.VideoFromCamera) }, modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.VideoFromCamera) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VideoCall())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VideoCall())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_camera_video)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_camera_video)) },
) )
ListItem( ListItem(
modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.FromGallery) }, modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.FromGallery) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Image())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Image())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_gallery)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_gallery)) },
) )
ListItem( ListItem(
modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.FromFiles) }, modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.FromFiles) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Attachment())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Attachment())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_files)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_files)) },
) )
if (state.canShareLocation) { if (state.canShareLocation) {
ListItem( ListItem(
@@ -130,7 +130,7 @@ private fun AttachmentSourcePickerMenu(
onSendLocationClick() onSendLocationClick()
}, },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.LocationPin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.LocationPin())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_location)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_location)) },
) )
} }
ListItem( ListItem(
@@ -139,13 +139,13 @@ private fun AttachmentSourcePickerMenu(
onCreatePollClick() onCreatePollClick()
}, },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_source_poll)) }, content = { Text(stringResource(R.string.screen_room_attachment_source_poll)) },
) )
if (enableTextFormatting) { if (enableTextFormatting) {
ListItem( ListItem(
modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.ToggleTextFormatting(enabled = true)) }, modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.ToggleTextFormatting(enabled = true)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.TextFormatting())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.TextFormatting())),
headlineContent = { Text(stringResource(R.string.screen_room_attachment_text_formatting)) }, content = { Text(stringResource(R.string.screen_room_attachment_text_formatting)) },
) )
} }
} }
@@ -86,7 +86,7 @@ private fun ReadReceiptBottomSheetContent(
LazyColumn { LazyColumn {
item { item {
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = CommonStrings.common_seen_by)) Text(text = stringResource(id = CommonStrings.common_seen_by))
} }
) )
@@ -107,7 +107,7 @@ fun CreatePollView(
item { item {
Column { Column {
ListItem( ListItem(
headlineContent = { content = {
TextField( TextField(
label = stringResource(id = R.string.screen_create_poll_question_desc), label = stringResource(id = R.string.screen_create_poll_question_desc),
value = state.question, value = state.question,
@@ -127,7 +127,7 @@ fun CreatePollView(
itemsIndexed(state.answers) { index, answer -> itemsIndexed(state.answers) { index, answer ->
val isLastItem = index == state.answers.size - 1 val isLastItem = index == state.answers.size - 1
ListItem( ListItem(
headlineContent = { content = {
TextField( TextField(
value = answer.text, value = answer.text,
onValueChange = { onValueChange = {
@@ -155,7 +155,7 @@ fun CreatePollView(
if (state.canAddAnswer) { if (state.canAddAnswer) {
item { item {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_add_option_btn)) }, content = { Text(text = stringResource(id = R.string.screen_create_poll_add_option_btn)) },
leadingContent = ListItemContent.Icon( leadingContent = ListItemContent.Icon(
iconSource = IconSource.Vector(CompoundIcons.Plus()), iconSource = IconSource.Vector(CompoundIcons.Plus()),
), ),
@@ -174,7 +174,7 @@ fun CreatePollView(
Column { Column {
HorizontalDivider() HorizontalDivider()
ListItem( ListItem(
headlineContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) }, content = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_headline)) },
supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) }, supportingContent = { Text(text = stringResource(id = R.string.screen_create_poll_anonymous_desc)) },
trailingContent = ListItemContent.Switch( trailingContent = ListItemContent.Switch(
checked = state.pollKind == PollKind.Undisclosed, checked = state.pollKind == PollKind.Undisclosed,
@@ -189,7 +189,7 @@ fun CreatePollView(
) )
if (state.canDelete) { if (state.canDelete) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(id = CommonStrings.action_delete_poll)) }, content = { Text(text = stringResource(id = CommonStrings.action_delete_poll)) },
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { state.eventSink(CreatePollEvent.Delete(confirmed = false)) }, onClick = { state.eventSink(CreatePollEvent.Delete(confirmed = false)) },
) )
@@ -34,14 +34,14 @@ fun AboutView(
) { ) {
state.elementLegals.forEach { elementLegal -> state.elementLegals.forEach { elementLegal ->
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = elementLegal.titleRes)) Text(stringResource(id = elementLegal.titleRes))
}, },
onClick = { onElementLegalClick(elementLegal) } onClick = { onElementLegalClick(elementLegal) }
) )
} }
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = CommonStrings.common_open_source_licenses)) Text(stringResource(id = CommonStrings.common_open_source_licenses))
}, },
onClick = onOpenSourceLicensesClick, onClick = onOpenSourceLicensesClick,
@@ -93,7 +93,7 @@ fun AdvancedSettingsView(
} }
) )
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = CommonStrings.action_view_source)) Text(text = stringResource(id = CommonStrings.action_view_source))
}, },
supportingContent = { supportingContent = {
@@ -105,7 +105,7 @@ fun AdvancedSettingsView(
onClick = { state.eventSink(AdvancedSettingsEvents.SetDeveloperModeEnabled(!state.isDeveloperModeEnabled)) } onClick = { state.eventSink(AdvancedSettingsEvents.SetDeveloperModeEnabled(!state.isDeveloperModeEnabled)) }
) )
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = R.string.screen_advanced_settings_share_presence)) Text(text = stringResource(id = R.string.screen_advanced_settings_share_presence))
}, },
supportingContent = { supportingContent = {
@@ -122,7 +122,7 @@ fun AdvancedSettingsView(
null -> Unit null -> Unit
is MediaOptimizationState.AllMedia -> { is MediaOptimizationState.AllMedia -> {
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = R.string.screen_advanced_settings_media_compression_title)) Text(text = stringResource(id = R.string.screen_advanced_settings_media_compression_title))
}, },
supportingContent = { supportingContent = {
@@ -146,7 +146,7 @@ fun AdvancedSettingsView(
} }
is MediaOptimizationState.Split -> { is MediaOptimizationState.Split -> {
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_image_upload_quality_title)) Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_image_upload_quality_title))
}, },
supportingContent = { supportingContent = {
@@ -171,7 +171,7 @@ fun AdvancedSettingsView(
var displaySelectorDialog by remember { mutableStateOf(false) } var displaySelectorDialog by remember { mutableStateOf(false) }
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_video_upload_quality_title)) Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_video_upload_quality_title))
}, },
supportingContent = { supportingContent = {
@@ -247,7 +247,7 @@ private fun VideoQualitySelectorDialog(
VideoCompressionPreset.HIGH -> stringResource(CommonStrings.common_video_quality_high_description) VideoCompressionPreset.HIGH -> stringResource(CommonStrings.common_video_quality_high_description)
} }
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = title, text = title,
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
@@ -301,7 +301,7 @@ private fun ModerationAndSafety(
} }
) )
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_always_hide)) }, content = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_always_hide)) },
leadingContent = ListItemContent.RadioButton( leadingContent = ListItemContent.RadioButton(
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Off, selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Off,
compact = true compact = true
@@ -312,7 +312,7 @@ private fun ModerationAndSafety(
enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading() enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading()
) )
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_private_rooms)) }, content = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_private_rooms)) },
leadingContent = ListItemContent.RadioButton( leadingContent = ListItemContent.RadioButton(
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Private, selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Private,
compact = true compact = true
@@ -323,7 +323,7 @@ private fun ModerationAndSafety(
enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading() enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading()
) )
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_always_show)) }, content = { Text(text = stringResource(R.string.screen_advanced_settings_show_media_timeline_always_show)) },
leadingContent = ListItemContent.RadioButton( leadingContent = ListItemContent.RadioButton(
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.On, selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.On,
compact = true compact = true
@@ -85,7 +85,7 @@ fun DeveloperSettingsView(
if (state.isEnterpriseBuild) { if (state.isEnterpriseBuild) {
PreferenceCategory(title = "Theme") { PreferenceCategory(title = "Theme") {
ListItem( ListItem(
headlineContent = { content = {
Text("Change brand color") Text("Change brand color")
}, },
onClick = { onClick = {
@@ -93,7 +93,7 @@ fun DeveloperSettingsView(
} }
) )
ListItem( ListItem(
headlineContent = { content = {
Text("Reset brand color") Text("Reset brand color")
}, },
onClick = { onClick = {
@@ -108,7 +108,7 @@ fun DeveloperSettingsView(
val cache = state.cacheSize val cache = state.cacheSize
PreferenceCategory(title = "Cache") { PreferenceCategory(title = "Cache") {
ListItem( ListItem(
headlineContent = { Text("Database sizes") }, content = { Text("Database sizes") },
supportingContent = { supportingContent = {
if (state.databaseSizes.isLoading()) { if (state.databaseSizes.isLoading()) {
Text("Computing...") Text("Computing...")
@@ -127,7 +127,7 @@ fun DeveloperSettingsView(
} }
) )
ListItem( ListItem(
headlineContent = { content = {
Text("Vacuum stores") Text("Vacuum stores")
}, },
onClick = { onClick = {
@@ -135,7 +135,7 @@ fun DeveloperSettingsView(
} }
) )
ListItem( ListItem(
headlineContent = { content = {
Text("Clear cache") Text("Clear cache")
}, },
trailingContent = if (state.cacheSize.isLoading() || state.clearCacheAction.isLoading()) { trailingContent = if (state.cacheSize.isLoading() || state.clearCacheAction.isLoading()) {
@@ -194,7 +194,7 @@ private fun SessionCategory(deviceId: DeviceId) {
private fun MarkAllRoomsAsReadCategory(state: DeveloperSettingsState) { private fun MarkAllRoomsAsReadCategory(state: DeveloperSettingsState) {
PreferenceCategory(title = "Room list") { PreferenceCategory(title = "Room list") {
ListItem( ListItem(
headlineContent = { content = {
Text("Mark all rooms as read") Text("Mark all rooms as read")
}, },
supportingContent = { supportingContent = {
@@ -220,7 +220,7 @@ private fun MarkAllRoomsAsReadCategory(state: DeveloperSettingsState) {
private fun NotificationCategory(onPushHistoryClick: () -> Unit) { private fun NotificationCategory(onPushHistoryClick: () -> Unit) {
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_title)) { PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_title)) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(R.string.troubleshoot_notifications_entry_point_push_history_title)) Text(stringResource(R.string.troubleshoot_notifications_entry_point_push_history_title))
}, },
onClick = onPushHistoryClick, onClick = onPushHistoryClick,
@@ -84,7 +84,7 @@ fun AppDeveloperSettingsView(
} }
PreferenceCategory(title = "Showkase") { PreferenceCategory(title = "Showkase") {
ListItem( ListItem(
headlineContent = { content = {
Text("Open Showkase browser") Text("Open Showkase browser")
}, },
onClick = onOpenShowkase onClick = onOpenShowkase
@@ -95,7 +95,7 @@ fun AppDeveloperSettingsView(
) )
PreferenceCategory(title = "Crash") { PreferenceCategory(title = "Crash") {
ListItem( ListItem(
headlineContent = { content = {
Text("Crash the app 💥") Text("Crash the app 💥")
}, },
onClick = { error("This crash is a test.") } onClick = { error("This crash is a test.") }
@@ -130,7 +130,7 @@ private fun NotificationSettingsContentView(
if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) { if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.NotificationsOffSolid())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.NotificationsOffSolid())),
headlineContent = { content = {
Text(stringResource(id = R.string.screen_notification_settings_system_notifications_turned_off)) Text(stringResource(id = R.string.screen_notification_settings_system_notifications_turned_off))
}, },
supportingContent = { supportingContent = {
@@ -158,7 +158,7 @@ private fun NotificationSettingsContentView(
PreferenceCategory { PreferenceCategory {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VoiceCallSolid())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VoiceCallSolid())),
headlineContent = { content = {
Text(stringResource(id = R.string.full_screen_intent_banner_title)) Text(stringResource(id = R.string.full_screen_intent_banner_title))
}, },
supportingContent = { supportingContent = {
@@ -172,7 +172,7 @@ private fun NotificationSettingsContentView(
} }
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_notification_section_title)) { PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_notification_section_title)) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_notification_settings_group_chats)) Text(stringResource(id = R.string.screen_notification_settings_group_chats))
}, },
supportingContent = { supportingContent = {
@@ -181,7 +181,7 @@ private fun NotificationSettingsContentView(
onClick = onGroupChatsClick onClick = onGroupChatsClick
) )
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_notification_settings_direct_chats)) Text(stringResource(id = R.string.screen_notification_settings_direct_chats))
}, },
supportingContent = { supportingContent = {
@@ -218,7 +218,7 @@ private fun NotificationSettingsContentView(
} }
PreferenceCategory(title = stringResource(id = R.string.troubleshoot_notifications_entry_point_section)) { PreferenceCategory(title = stringResource(id = R.string.troubleshoot_notifications_entry_point_section)) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.troubleshoot_notifications_entry_point_title)) Text(stringResource(id = R.string.troubleshoot_notifications_entry_point_title))
}, },
onClick = onTroubleshootNotificationsClick onClick = onTroubleshootNotificationsClick
@@ -227,7 +227,7 @@ private fun NotificationSettingsContentView(
if (state.showAdvancedSettings) { if (state.showAdvancedSettings) {
PreferenceCategory(title = stringResource(id = CommonStrings.common_advanced_settings)) { PreferenceCategory(title = stringResource(id = CommonStrings.common_advanced_settings)) {
ListItem( ListItem(
headlineContent = { content = {
Text(text = stringResource(id = R.string.screen_advanced_settings_push_provider_android)) Text(text = stringResource(id = R.string.screen_advanced_settings_push_provider_android))
}, },
trailingContent = when (state.currentPushDistributor) { trailingContent = when (state.currentPushDistributor) {
@@ -296,7 +296,7 @@ private fun SoundsPreferenceCategory(state: NotificationSettingsState) {
} }
} }
ListItem( ListItem(
headlineContent = { Text(stringResource(id = R.string.screen_notification_settings_message_sound_label)) }, content = { Text(stringResource(id = R.string.screen_notification_settings_message_sound_label)) },
supportingContent = { Text(state.messageSound.displayName) }, supportingContent = { Text(state.messageSound.displayName) },
onClick = { state.eventSink(NotificationSettingsEvents.ShowMessageSoundDialog) }, onClick = { state.eventSink(NotificationSettingsEvents.ShowMessageSoundDialog) },
) )
@@ -323,7 +323,7 @@ private fun SoundsPreferenceCategory(state: NotificationSettingsState) {
} }
} }
ListItem( ListItem(
headlineContent = { Text(stringResource(id = R.string.screen_notification_settings_call_ringtone_label)) }, content = { Text(stringResource(id = R.string.screen_notification_settings_call_ringtone_label)) },
supportingContent = { Text(state.callRingtone.displayName) }, supportingContent = { Text(state.callRingtone.displayName) },
onClick = { state.eventSink(NotificationSettingsEvents.ShowCallRingtoneDialog) }, onClick = { state.eventSink(NotificationSettingsEvents.ShowCallRingtoneDialog) },
) )
@@ -418,7 +418,7 @@ private fun SoundCopyErrorRow(
modifier = Modifier modifier = Modifier
.background(ElementTheme.colors.bgSubtleSecondary) .background(ElementTheme.colors.bgSubtleSecondary)
.semantics { liveRegion = LiveRegionMode.Polite }, .semantics { liveRegion = LiveRegionMode.Polite },
headlineContent = { content = {
Text( Text(
text = stringResource(R.string.screen_notification_settings_sound_set_sound_error_title), text = stringResource(R.string.screen_notification_settings_sound_set_sound_error_title),
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
@@ -40,7 +40,7 @@ fun DefaultNotificationSettingOption(
} }
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(title) }, content = { Text(title) },
supportingContent = subtitle?.let { { Text(it) } }, supportingContent = subtitle?.let { { Text(it) } },
trailingContent = ListItemContent.RadioButton(selected = isSelected), trailingContent = ListItemContent.RadioButton(selected = isSelected),
onClick = { onSelectOption(mode) }, onClick = { onSelectOption(mode) },
@@ -88,7 +88,7 @@ fun EditDefaultNotificationSettingView(
null -> "" null -> ""
} }
ListItem( ListItem(
headlineContent = { content = {
val roomName = summary.name val roomName = summary.name
Text( Text(
text = roomName ?: stringResource(id = CommonStrings.common_no_room_name), text = roomName ?: stringResource(id = CommonStrings.common_no_room_name),
@@ -182,7 +182,7 @@ private fun ColumnScope.MultiAccountSection(
} }
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())),
headlineContent = { content = {
Text(stringResource(CommonStrings.common_add_another_account)) Text(stringResource(CommonStrings.common_add_another_account))
}, },
onClick = onAddAccountClick, onClick = onAddAccountClick,
@@ -201,18 +201,18 @@ private fun ColumnScope.ManageAppSection(
onSecureBackupClick: () -> Unit, onSecureBackupClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = R.string.screen_notification_settings_title)) }, content = { Text(stringResource(id = R.string.screen_notification_settings_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())),
onClick = onOpenNotificationSettings, onClick = onOpenNotificationSettings,
) )
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_screen_lock)) }, content = { Text(stringResource(id = CommonStrings.common_screen_lock)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
onClick = onOpenLockScreenSettings, onClick = onOpenLockScreenSettings,
) )
if (state.showSecureBackup) { if (state.showSecureBackup) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_encryption)) }, content = { Text(stringResource(id = CommonStrings.common_encryption)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Key())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Key())),
trailingContent = ListItemContent.Badge.takeIf { state.showSecureBackupBadge }, trailingContent = ListItemContent.Badge.takeIf { state.showSecureBackupBadge },
onClick = onSecureBackupClick, onClick = onSecureBackupClick,
@@ -230,7 +230,7 @@ private fun ColumnScope.ManageAccountSection(
) { ) {
state.accountManagementUrl?.let { url -> state.accountManagementUrl?.let { url ->
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.action_manage_account_and_devices)) }, content = { Text(stringResource(id = CommonStrings.action_manage_account_and_devices)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())),
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.PopOut())), trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.PopOut())),
onClick = { onManageAccountClick(url) }, onClick = { onManageAccountClick(url) },
@@ -238,14 +238,14 @@ private fun ColumnScope.ManageAccountSection(
} }
if (state.showLinkNewDevice) { if (state.showLinkNewDevice) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_link_new_device)) }, content = { Text(stringResource(id = CommonStrings.common_link_new_device)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Devices())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Devices())),
onClick = onLinkNewDeviceClick, onClick = onLinkNewDeviceClick,
) )
} }
if (state.showBlockedUsersItem) { if (state.showBlockedUsersItem) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_blocked_users)) }, content = { Text(stringResource(id = CommonStrings.common_blocked_users)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())),
onClick = onOpenBlockedUsers, onClick = onOpenBlockedUsers,
trailingContent = ListItemContent.Text(state.nbOfBlockedUsers.toString()), trailingContent = ListItemContent.Text(state.nbOfBlockedUsers.toString()),
@@ -269,46 +269,46 @@ private fun ColumnScope.GeneralSection(
onDeactivateClick: () -> Unit, onDeactivateClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_advanced_settings)) }, content = { Text(stringResource(id = CommonStrings.common_advanced_settings)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Settings())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Settings())),
onClick = onOpenAdvancedSettings, onClick = onOpenAdvancedSettings,
) )
if (state.showLabsItem) { if (state.showLabsItem) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = R.string.screen_labs_title)) }, content = { Text(stringResource(id = R.string.screen_labs_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Labs())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Labs())),
onClick = onOpenLabs, onClick = onOpenLabs,
) )
} }
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_about)) }, content = { Text(stringResource(id = CommonStrings.common_about)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Info())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Info())),
onClick = onOpenAbout, onClick = onOpenAbout,
) )
if (state.canReportBug) { if (state.canReportBug) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_report_a_problem)) }, content = { Text(stringResource(id = CommonStrings.common_report_a_problem)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())),
onClick = onOpenRageShake onClick = onOpenRageShake
) )
} }
if (state.showAnalyticsSettings) { if (state.showAnalyticsSettings) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_analytics)) }, content = { Text(stringResource(id = CommonStrings.common_analytics)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Chart())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Chart())),
onClick = onOpenAnalytics, onClick = onOpenAnalytics,
) )
} }
HorizontalDivider() HorizontalDivider()
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.action_signout)) }, content = { Text(stringResource(id = CommonStrings.action_signout)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Close())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Close())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = onSignOutClick, onClick = onSignOutClick,
) )
if (state.canDeactivateAccount) { if (state.canDeactivateAccount) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.action_delete_account)) }, content = { Text(stringResource(id = CommonStrings.action_delete_account)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = onDeactivateClick, onClick = onDeactivateClick,
@@ -340,7 +340,7 @@ private fun ColumnScope.Footer(
@Composable @Composable
private fun DeveloperPreferencesView(onOpenDeveloperSettings: () -> Unit) { private fun DeveloperPreferencesView(onOpenDeveloperSettings: () -> Unit) {
ListItem( ListItem(
headlineContent = { Text(stringResource(id = CommonStrings.common_developer_options)) }, content = { Text(stringResource(id = CommonStrings.common_developer_options)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Code())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Code())),
onClick = onOpenDeveloperSettings onClick = onOpenDeveloperSettings
) )
@@ -56,7 +56,7 @@ fun RageshakePreferencesView(
) )
} else { } else {
ListItem( ListItem(
headlineContent = { content = {
Text("Rageshaking is not supported by your device") Text("Rageshaking is not supported by your device")
}, },
) )
@@ -101,7 +101,7 @@ fun BugReportView(
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
PreferenceDivider() PreferenceDivider()
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(id = R.string.screen_bug_report_view_logs)) Text(stringResource(id = R.string.screen_bug_report_view_logs))
}, },
enabled = isFormEnabled, enabled = isFormEnabled,
@@ -108,7 +108,7 @@ fun ReportRoomView(
ListItem( ListItem(
modifier = Modifier.padding(end = 8.dp), modifier = Modifier.padding(end = 8.dp),
headlineContent = { content = {
Text(text = stringResource(CommonStrings.action_leave_room)) Text(text = stringResource(CommonStrings.action_leave_room))
}, },
onClick = { onClick = {
@@ -62,7 +62,7 @@ fun RolesAndPermissionsView(
stringResource(R.string.screen_room_roles_and_permissions_admins) stringResource(R.string.screen_room_roles_and_permissions_admins)
} }
ListItem( ListItem(
headlineContent = { Text(adminsTitle) }, content = { Text(adminsTitle) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())),
trailingContent = state.adminCount?.let { adminCount -> trailingContent = state.adminCount?.let { adminCount ->
ListItemContent.Text("$adminCount") ListItemContent.Text("$adminCount")
@@ -70,7 +70,7 @@ fun RolesAndPermissionsView(
onClick = { rolesAndPermissionsNavigator.openAdminList() }, onClick = { rolesAndPermissionsNavigator.openAdminList() },
) )
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_roles_and_permissions_moderators)) }, content = { Text(stringResource(R.string.screen_room_roles_and_permissions_moderators)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())),
trailingContent = state.moderatorCount?.let { moderationCount -> trailingContent = state.moderatorCount?.let { moderationCount ->
ListItemContent.Text("$moderationCount") ListItemContent.Text("$moderationCount")
@@ -79,20 +79,20 @@ fun RolesAndPermissionsView(
) )
if (state.canSelfDemote) { if (state.canSelfDemote) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_roles_and_permissions_change_my_role)) }, content = { Text(stringResource(R.string.screen_room_roles_and_permissions_change_my_role)) },
onClick = { state.eventSink(RolesAndPermissionsEvents.ChangeOwnRole) }, onClick = { state.eventSink(RolesAndPermissionsEvents.ChangeOwnRole) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Edit())) leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Edit()))
) )
} }
HorizontalDivider() HorizontalDivider()
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_roles_and_permissions_permissions_header)) }, content = { Text(stringResource(R.string.screen_room_roles_and_permissions_permissions_header)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Settings())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Settings())),
onClick = { rolesAndPermissionsNavigator.openEditPermissions() }, onClick = { rolesAndPermissionsNavigator.openEditPermissions() },
) )
HorizontalDivider() HorizontalDivider()
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_roles_and_permissions_reset)) }, content = { Text(stringResource(R.string.screen_room_roles_and_permissions_reset)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())),
onClick = { state.eventSink(RolesAndPermissionsEvents.ResetPermissions) }, onClick = { state.eventSink(RolesAndPermissionsEvents.ResetPermissions) },
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
@@ -173,7 +173,7 @@ private fun ChangeOwnRoleBottomSheet(
) )
for (demoteAction in availableDemoteActions) { for (demoteAction in availableDemoteActions) {
ListItem( ListItem(
headlineContent = { Text(stringResource(demoteAction.titleRes)) }, content = { Text(stringResource(demoteAction.titleRes)) },
onClick = { onClick = {
sheetState.hide(coroutineScope) { sheetState.hide(coroutineScope) {
eventSink(RolesAndPermissionsEvents.DemoteSelfTo(demoteAction.role)) eventSink(RolesAndPermissionsEvents.DemoteSelfTo(demoteAction.role))
@@ -183,7 +183,7 @@ private fun ChangeOwnRoleBottomSheet(
) )
} }
ListItem( ListItem(
headlineContent = { Text(stringResource(CommonStrings.action_cancel)) }, content = { Text(stringResource(CommonStrings.action_cancel)) },
onClick = ::dismiss, onClick = ::dismiss,
) )
} }
@@ -202,7 +202,7 @@ fun RoomDetailsView(
PreferenceCategory { PreferenceCategory {
if (state.hasNewContent) { if (state.hasNewContent) {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_roomlist_mark_as_read), text = stringResource(id = R.string.screen_roomlist_mark_as_read),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
@@ -225,7 +225,7 @@ fun RoomDetailsView(
) )
} else { } else {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_roomlist_mark_as_unread), text = stringResource(id = R.string.screen_roomlist_mark_as_unread),
) )
@@ -268,7 +268,7 @@ fun RoomDetailsView(
} }
if (state.displayRolesAndPermissionsSettings) { if (state.displayRolesAndPermissionsSettings) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_roles_and_permissions)) }, content = { Text(stringResource(R.string.screen_room_details_roles_and_permissions)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())),
onClick = openAdminSettings, onClick = openAdminSettings,
) )
@@ -317,7 +317,7 @@ fun RoomDetailsView(
) { ) {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
headlineContent = { content = {
Text(stringResource(id = R.string.screen_room_details_encryption_enabled_title)) Text(stringResource(id = R.string.screen_room_details_encryption_enabled_title))
}, },
supportingContent = { supportingContent = {
@@ -345,7 +345,7 @@ fun RoomDetailsView(
@Composable @Composable
private fun KnockRequestsItem(knockRequestsCount: Int?, onKnockRequestsClick: () -> Unit) { private fun KnockRequestsItem(knockRequestsCount: Int?, onKnockRequestsClick: () -> Unit) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_requests_to_join_title)) }, content = { Text(stringResource(R.string.screen_room_details_requests_to_join_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.AskToJoin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.AskToJoin())),
trailingContent = if (knockRequestsCount == null || knockRequestsCount == 0) { trailingContent = if (knockRequestsCount == null || knockRequestsCount == 0) {
null null
@@ -656,7 +656,7 @@ private fun TopicSection(
if (roomTopic is RoomTopicState.CanAddTopic) { if (roomTopic is RoomTopicState.CanAddTopic) {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())),
headlineContent = { content = {
Text(stringResource(id = R.string.screen_room_details_add_topic_title)) Text(stringResource(id = R.string.screen_room_details_add_topic_title))
}, },
onClick = { onClick = {
@@ -687,7 +687,7 @@ private fun NotificationItem(
stringResource(R.string.screen_room_details_notification_mode_custom) stringResource(R.string.screen_room_details_notification_mode_custom)
} }
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_room_details_notification_title)) }, content = { Text(text = stringResource(R.string.screen_room_details_notification_title)) },
supportingContent = { Text(text = subtitle) }, supportingContent = { Text(text = subtitle) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Notifications())),
onClick = openRoomNotificationSettings, onClick = openRoomNotificationSettings,
@@ -700,7 +700,7 @@ private fun SecurityAndPrivacyItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_security_and_privacy_title)) }, content = { Text(stringResource(R.string.screen_room_details_security_and_privacy_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
onClick = onClick, onClick = onClick,
modifier = modifier, modifier = modifier,
@@ -732,7 +732,7 @@ private fun ProfileItem(
) { ) {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())),
headlineContent = { Text(stringResource(id = R.string.screen_room_details_profile_row_title)) }, content = { Text(stringResource(id = R.string.screen_room_details_profile_row_title)) },
trailingContent = when (verificationState) { trailingContent = when (verificationState) {
UserProfileVerificationState.VERIFIED -> ListItemContent.Icon( UserProfileVerificationState.VERIFIED -> ListItemContent.Icon(
iconSource = IconSource.Vector(CompoundIcons.Verified()), iconSource = IconSource.Vector(CompoundIcons.Verified()),
@@ -755,7 +755,7 @@ private fun MembersItem(
openRoomMemberList: () -> Unit, openRoomMemberList: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(CommonStrings.common_people)) }, content = { Text(stringResource(CommonStrings.common_people)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.User())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.User())),
trailingContent = if (hasVerificationViolations) { trailingContent = if (hasVerificationViolations) {
ListItemContent.Icon( ListItemContent.Icon(
@@ -774,7 +774,7 @@ private fun InviteItem(
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_invite_title)) }, content = { Text(stringResource(R.string.screen_room_details_invite_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserAdd())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserAdd())),
onClick = onClick, onClick = onClick,
) )
@@ -787,7 +787,7 @@ private fun PinnedMessagesItem(
) { ) {
val analyticsService = LocalAnalyticsService.current val analyticsService = LocalAnalyticsService.current
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_pinned_events_row_title)) }, content = { Text(stringResource(R.string.screen_room_details_pinned_events_row_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Pin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Pin())),
trailingContent = trailingContent =
if (pinnedMessagesCount == null) { if (pinnedMessagesCount == null) {
@@ -809,7 +809,7 @@ private fun PollsItem(
openPollHistory: () -> Unit, openPollHistory: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_polls_history_title)) }, content = { Text(stringResource(R.string.screen_polls_history_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls())),
onClick = openPollHistory, onClick = openPollHistory,
) )
@@ -820,7 +820,7 @@ private fun MediaGalleryItem(
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_details_media_gallery_title)) }, content = { Text(stringResource(R.string.screen_room_details_media_gallery_title)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Image())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Image())),
onClick = onClick, onClick = onClick,
) )
@@ -840,7 +840,7 @@ private fun OtherActionsSection(
} }
if (canReportRoom) { if (canReportRoom) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.action_report_room)) Text(stringResource(CommonStrings.action_report_room))
}, },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ChatProblem())),
@@ -849,7 +849,7 @@ private fun OtherActionsSection(
) )
} }
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.action_leave_room)) Text(stringResource(CommonStrings.action_leave_room))
}, },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave())),
@@ -868,7 +868,7 @@ private fun DebugInfoSection(
PreferenceCategory { PreferenceCategory {
val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard) val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard)
ListItem( ListItem(
headlineContent = { content = {
Text("Internal room ID") Text("Internal room ID")
}, },
supportingContent = { supportingContent = {
@@ -888,7 +888,7 @@ private fun DebugInfoSection(
}, },
) )
ListItem( ListItem(
headlineContent = { content = {
Text("Room version") Text("Room version")
}, },
supportingContent = { supportingContent = {
@@ -40,7 +40,7 @@ fun RoomNotificationSettingsOption(
ListItem( ListItem(
modifier = modifier, modifier = modifier,
enabled = enabled, enabled = enabled,
headlineContent = { Text(title) }, content = { Text(title) },
supportingContent = subtitle?.let { { Text(it) } }, supportingContent = subtitle?.let { { Text(it) } },
trailingContent = ListItemContent.RadioButton(selected = isSelected), trailingContent = ListItemContent.RadioButton(selected = isSelected),
onClick = { onSelectOption(roomNotificationSettingsItem) }, onClick = { onSelectOption(roomNotificationSettingsItem) },
@@ -66,7 +66,7 @@ fun UserDefinedRoomNotificationSettingsView(
} }
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_room_notification_settings_edit_remove_setting)) }, content = { Text(stringResource(R.string.screen_room_notification_settings_edit_remove_setting)) },
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { onClick = {
state.eventSink(RoomNotificationSettingsEvent.DeleteCustomNotification) state.eventSink(RoomNotificationSettingsEvent.DeleteCustomNotification)
@@ -301,7 +301,7 @@ private fun RoomMemberActionsBottomSheet(
when (val action = actionState.action) { when (val action = actionState.action) {
is ModerationAction.DisplayProfile -> { is ModerationAction.DisplayProfile -> {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_member_user_info)) }, content = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_member_user_info)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.UserProfile())),
onClick = { onClick = {
coroutineScope.launch { coroutineScope.launch {
@@ -314,7 +314,7 @@ private fun RoomMemberActionsBottomSheet(
} }
is ModerationAction.KickUser -> { is ModerationAction.KickUser -> {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_remove)) }, content = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_remove)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Close())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Close())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { onClick = {
@@ -328,7 +328,7 @@ private fun RoomMemberActionsBottomSheet(
} }
is ModerationAction.BanUser -> { is ModerationAction.BanUser -> {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_ban)) }, content = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_ban)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { onClick = {
@@ -342,7 +342,7 @@ private fun RoomMemberActionsBottomSheet(
} }
is ModerationAction.UnbanUser -> { is ModerationAction.UnbanUser -> {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_unban)) }, content = { Text(stringResource(R.string.screen_bottom_sheet_manage_room_member_unban)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Restart())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Restart())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { onClick = {
@@ -55,7 +55,7 @@ fun SecureBackupRootView(
snackbarHost = { SnackbarHost(snackbarHostState) }, snackbarHost = { SnackbarHost(snackbarHostState) },
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_chat_backup_key_backup_title), text = stringResource(id = R.string.screen_chat_backup_key_backup_title),
) )
@@ -76,7 +76,7 @@ fun SecureBackupRootView(
// Disable / Enable key storage // Disable / Enable key storage
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_chat_backup_key_storage_toggle_title), text = stringResource(id = R.string.screen_chat_backup_key_storage_toggle_title),
) )
@@ -137,7 +137,7 @@ fun SecureBackupRootView(
RecoveryState.WAITING_FOR_SYNC -> Unit RecoveryState.WAITING_FOR_SYNC -> Unit
RecoveryState.DISABLED -> { RecoveryState.DISABLED -> {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_chat_backup_recovery_action_setup), text = stringResource(id = R.string.screen_chat_backup_recovery_action_setup),
) )
@@ -161,7 +161,7 @@ fun SecureBackupRootView(
} }
RecoveryState.ENABLED -> { RecoveryState.ENABLED -> {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_chat_backup_recovery_action_change), text = stringResource(id = R.string.screen_chat_backup_recovery_action_change),
) )
@@ -184,7 +184,7 @@ fun SecureBackupRootView(
} }
RecoveryState.INCOMPLETE -> RecoveryState.INCOMPLETE ->
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(id = R.string.screen_chat_backup_recovery_action_confirm), text = stringResource(id = R.string.screen_chat_backup_recovery_action_confirm),
) )
@@ -140,7 +140,7 @@ private fun CheckableSpaceListItem(
enabled: Boolean = true, enabled: Boolean = true,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(text = headlineText) Text(text = headlineText)
}, },
supportingContent = supportingText?.let { supportingContent = supportingText?.let {
@@ -235,7 +235,7 @@ private fun RoomAccessSection(
modifier = modifier, modifier = modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_anyone_option_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_anyone_option_title)) },
supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_anyone_option_description)) }, supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_anyone_option_description)) },
trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.Anyone), trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.Anyone),
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Public())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Public())),
@@ -243,7 +243,7 @@ private fun RoomAccessSection(
) )
if (state.showSpaceMemberOption) { if (state.showSpaceMemberOption) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_space_members_option_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_space_members_option_title)) },
supportingContent = { supportingContent = {
Text(text = state.spaceMemberDescription()) Text(text = state.spaceMemberDescription())
}, },
@@ -255,7 +255,7 @@ private fun RoomAccessSection(
} }
if (state.showAskToJoinOption) { if (state.showAskToJoinOption) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_title)) },
supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_description)) }, supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_description)) },
trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.AskToJoin), trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.AskToJoin),
onClick = { onSelectOption(SecurityAndPrivacyRoomAccess.AskToJoin) }, onClick = { onSelectOption(SecurityAndPrivacyRoomAccess.AskToJoin) },
@@ -265,7 +265,7 @@ private fun RoomAccessSection(
} }
if (state.showAskToJoinWithSpaceMemberOption) { if (state.showAskToJoinWithSpaceMemberOption) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_ask_to_join_option_title)) },
supportingContent = { Text(text = state.askToJoinWithSpaceMembersDescription()) }, supportingContent = { Text(text = state.askToJoinWithSpaceMembersDescription()) },
trailingContent = ListItemContent.RadioButton(selected = edited is SecurityAndPrivacyRoomAccess.AskToJoinWithSpaceMember), trailingContent = ListItemContent.RadioButton(selected = edited is SecurityAndPrivacyRoomAccess.AskToJoinWithSpaceMember),
onClick = ::onAskToJoinWithSpaceMembersClick, onClick = ::onAskToJoinWithSpaceMembersClick,
@@ -274,7 +274,7 @@ private fun RoomAccessSection(
) )
} }
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_invite_only_option_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_invite_only_option_title)) },
supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_invite_only_option_description)) }, supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_access_invite_only_option_description)) },
trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.InviteOnly), trailingContent = ListItemContent.RadioButton(selected = edited == SecurityAndPrivacyRoomAccess.InviteOnly),
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
@@ -330,7 +330,7 @@ private fun RoomAddressSection(
modifier = modifier, modifier = modifier,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(text = roomAddress ?: stringResource(R.string.screen_security_and_privacy_add_room_address_action)) Text(text = roomAddress ?: stringResource(R.string.screen_security_and_privacy_add_room_address_action))
}, },
trailingContent = if (roomAddress.isNullOrEmpty()) ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())) else null, trailingContent = if (roomAddress.isNullOrEmpty()) ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())) else null,
@@ -340,7 +340,7 @@ private fun RoomAddressSection(
) )
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_room_directory_visibility_toggle_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_room_directory_visibility_toggle_title)) },
supportingContent = { supportingContent = {
Text(text = stringResource(R.string.screen_security_and_privacy_room_directory_visibility_toggle_description, homeserverName)) Text(text = stringResource(R.string.screen_security_and_privacy_room_directory_visibility_toggle_description, homeserverName))
}, },
@@ -387,7 +387,7 @@ private fun EncryptionSection(
modifier = modifier, modifier = modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(text = stringResource(R.string.screen_security_and_privacy_encryption_toggle_title)) }, content = { Text(text = stringResource(R.string.screen_security_and_privacy_encryption_toggle_title)) },
supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_encryption_section_footer)) }, supportingContent = { Text(text = stringResource(R.string.screen_security_and_privacy_encryption_section_footer)) },
trailingContent = ListItemContent.Switch( trailingContent = ListItemContent.Switch(
checked = isRoomEncrypted, checked = isRoomEncrypted,
@@ -459,7 +459,7 @@ private fun HistoryVisibilityItem(
SecurityAndPrivacyHistoryVisibility.WorldReadable -> stringResource(R.string.screen_security_and_privacy_room_history_anyone_option_title) SecurityAndPrivacyHistoryVisibility.WorldReadable -> stringResource(R.string.screen_security_and_privacy_room_history_anyone_option_title)
} }
ListItem( ListItem(
headlineContent = { Text(text = headlineText) }, content = { Text(text = headlineText) },
trailingContent = ListItemContent.RadioButton(selected = isSelected, enabled = isEnabled), trailingContent = ListItemContent.RadioButton(selected = isSelected, enabled = isEnabled),
onClick = { onSelectOption(option) }, onClick = { onSelectOption(option) },
enabled = isEnabled, enabled = isEnabled,
@@ -169,7 +169,7 @@ private fun SecurityAndPrivacyItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_space_settings_security_and_privacy)) }, content = { Text(stringResource(R.string.screen_space_settings_security_and_privacy)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
onClick = onClick, onClick = onClick,
modifier = modifier, modifier = modifier,
@@ -183,7 +183,7 @@ private fun MembersItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(CommonStrings.common_people)) }, content = { Text(stringResource(CommonStrings.common_people)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.User())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.User())),
trailingContent = ListItemContent.Text(memberCount.toString()), trailingContent = ListItemContent.Text(memberCount.toString()),
onClick = onClick, onClick = onClick,
@@ -197,7 +197,7 @@ private fun RolesAndPermissionsItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_space_settings_roles_and_permissions)) }, content = { Text(stringResource(R.string.screen_space_settings_roles_and_permissions)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Admin())),
onClick = onClick, onClick = onClick,
modifier = modifier, modifier = modifier,
@@ -210,7 +210,7 @@ private fun LeaveSpaceItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
ListItem( ListItem(
headlineContent = { content = {
Text(stringResource(CommonStrings.action_leave_space)) Text(stringResource(CommonStrings.action_leave_space))
}, },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave())),
@@ -137,7 +137,7 @@ private fun VerifyUserSection(
) { ) {
if (state.verificationState == UserProfileVerificationState.UNVERIFIED) { if (state.verificationState == UserProfileVerificationState.UNVERIFIED) {
ListItem( ListItem(
headlineContent = { Text(stringResource(CommonStrings.common_verify_user)) }, content = { Text(stringResource(CommonStrings.common_verify_user)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
onClick = onVerifyClick, onClick = onVerifyClick,
) )
@@ -80,14 +80,14 @@ private fun PreferenceBlockUser(
} }
if (isBlocked.orFalse()) { if (isBlocked.orFalse()) {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_dm_details_unblock_user)) }, content = { Text(stringResource(R.string.screen_dm_details_unblock_user)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())),
onClick = { if (!isLoading) eventSink(UserProfileEvents.UnblockUser(needsConfirmation = true)) }, onClick = { if (!isLoading) eventSink(UserProfileEvents.UnblockUser(needsConfirmation = true)) },
trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null, trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null,
) )
} else { } else {
ListItem( ListItem(
headlineContent = { Text(stringResource(R.string.screen_dm_details_block_user)) }, content = { Text(stringResource(R.string.screen_dm_details_block_user)) },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())),
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { if (!isLoading) eventSink(UserProfileEvents.BlockUser(needsConfirmation = true)) }, onClick = { if (!isLoading) eventSink(UserProfileEvents.BlockUser(needsConfirmation = true)) },
@@ -100,7 +100,7 @@ private fun ItemRow(
Item.Parent -> { Item.Parent -> {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(Icons.Outlined.SubdirectoryArrowLeft)), leadingContent = ListItemContent.Icon(IconSource.Vector(Icons.Outlined.SubdirectoryArrowLeft)),
headlineContent = { content = {
Text( Text(
text = "..", text = "..",
modifier = Modifier.padding(16.dp), modifier = Modifier.padding(16.dp),
@@ -113,7 +113,7 @@ private fun ItemRow(
is Item.Folder -> { is Item.Folder -> {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(Icons.Outlined.Folder)), leadingContent = ListItemContent.Icon(IconSource.Vector(Icons.Outlined.Folder)),
headlineContent = { content = {
Text( Text(
text = item.name, text = item.name,
modifier = Modifier.padding(16.dp), modifier = Modifier.padding(16.dp),
@@ -126,7 +126,7 @@ private fun ItemRow(
is Item.File -> { is Item.File -> {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Document())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Document())),
headlineContent = { content = {
Text( Text(
text = item.name, text = item.name,
modifier = Modifier.padding(16.dp), modifier = Modifier.padding(16.dp),
@@ -45,7 +45,7 @@ fun AvatarListItem(
) { ) {
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(headline) }, content = { Text(headline) },
supportingContent = supportingText?.let { @Composable { Text(it) } }, supportingContent = supportingText?.let { @Composable { Text(it) } },
leadingContent = ListItemContent.Custom { _ -> leadingContent = ListItemContent.Custom { _ ->
Avatar( Avatar(
@@ -28,7 +28,7 @@ fun CheckboxListItem(
) { ) {
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(headline) }, content = { Text(headline) },
supportingContent = supportingText?.let { @Composable { Text(it) } }, supportingContent = supportingText?.let { @Composable { Text(it) } },
leadingContent = ListItemContent.Checkbox( leadingContent = ListItemContent.Checkbox(
checked = checked, checked = checked,
@@ -68,7 +68,7 @@ fun MultipleSelectionListItem(
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(text = headline) }, content = { Text(text = headline) },
supportingContent = decoratedSupportedText, supportingContent = decoratedSupportedText,
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = trailingContent, trailingContent = trailingContent,
@@ -28,7 +28,7 @@ fun RadioButtonListItem(
) { ) {
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(headline) }, content = { Text(headline) },
supportingContent = supportingText?.let { @Composable { Text(it) } }, supportingContent = supportingText?.let { @Composable { Text(it) } },
leadingContent = ListItemContent.RadioButton( leadingContent = ListItemContent.RadioButton(
selected = selected, selected = selected,
@@ -67,7 +67,7 @@ fun SingleSelectionListItem(
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(text = headline) }, content = { Text(text = headline) },
supportingContent = decoratedSupportedText, supportingContent = decoratedSupportedText,
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = trailingContent, trailingContent = trailingContent,
@@ -27,7 +27,7 @@ fun SwitchListItem(
) { ) {
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(headline) }, content = { Text(headline) },
supportingContent = supportingText?.let { @Composable { Text(it) } }, supportingContent = supportingText?.let { @Composable { Text(it) } },
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = ListItemContent.Switch( trailingContent = ListItemContent.Switch(
@@ -45,7 +45,7 @@ fun PreferenceCheckbox(
iconResourceId = iconResourceId, iconResourceId = iconResourceId,
showIconAreaIfNoIcon = showIconAreaIfNoIcon, showIconAreaIfNoIcon = showIconAreaIfNoIcon,
), ),
headlineContent = { content = {
Text( Text(
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
text = title, text = title,
@@ -66,7 +66,7 @@ fun <T : DropdownOption> PreferenceDropdown(
iconResourceId = iconResourceId, iconResourceId = iconResourceId,
showIconAreaIfNoIcon = showIconAreaIfNoIcon, showIconAreaIfNoIcon = showIconAreaIfNoIcon,
), ),
headlineContent = { content = {
Text( Text(
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -30,7 +30,7 @@ fun PreferenceRow(
) { ) {
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { content = {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
@@ -46,7 +46,7 @@ fun PreferenceSlide(
iconResourceId = iconResourceId, iconResourceId = iconResourceId,
showIconAreaIfNoIcon = showIconAreaIfNoIcon, showIconAreaIfNoIcon = showIconAreaIfNoIcon,
), ),
headlineContent = { content = {
Column { Column {
Text( Text(
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
@@ -44,7 +44,7 @@ fun PreferenceSwitch(
iconResourceId = iconResourceId, iconResourceId = iconResourceId,
showIconAreaIfNoIcon = showIconAreaIfNoIcon, showIconAreaIfNoIcon = showIconAreaIfNoIcon,
), ),
headlineContent = { content = {
Text( Text(
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
text = title, text = title,
@@ -42,7 +42,7 @@ fun PreferenceTextField(
ListItem( ListItem(
modifier = modifier, modifier = modifier,
headlineContent = { Text(headline) }, content = { Text(headline) },
supportingContent = valueToDisplay?.let { @Composable { Text(it) } }, supportingContent = valueToDisplay?.let { @Composable { Text(it) } },
trailingContent = trailingContent, trailingContent = trailingContent,
style = style, style = style,
@@ -35,20 +35,19 @@ import io.element.android.libraries.designsystem.preview.PreviewGroup
/** /**
* A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines. * A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines.
* @param headlineContent The main content of the list item, usually a text.
* @param modifier The modifier to be applied to the list item. * @param modifier The modifier to be applied to the list item.
* @param supportingContent The content to be displayed below the headline content. * @param supportingContent The content to be displayed below the content.
* @param leadingContent The content to be displayed before the headline content. * @param leadingContent The content to be displayed before the content.
* @param trailingContent The content to be displayed after the headline content. * @param trailingContent The content to be displayed after the content.
* @param style The style to use for the list item. This may change the color and text styles of the contents. [ListItemStyle.Default] is used by default. * @param style The style to use for the list item. This may change the color and text styles of the contents. [ListItemStyle.Default] is used by default.
* @param enabled Whether the list item is enabled. When disabled, will change the color of the headline content and the leading content to use disabled tokens. * @param enabled Whether the list item is enabled. When disabled, will change the color of the content and the leading content to use disabled tokens.
* @param alwaysClickable Whether the list item should always be clickable, even when disabled. * @param alwaysClickable Whether the list item should always be clickable, even when disabled.
* @param onClick The callback to be called when the list item is clicked. * @param onClick The callback to be called when the list item is clicked.
* @param content The main content of the list item, usually a text.
*/ */
@Suppress("LongParameterList") @Suppress("LongParameterList")
@Composable @Composable
fun ListItem( fun ListItem(
headlineContent: @Composable () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
supportingContent: @Composable (() -> Unit)? = null, supportingContent: @Composable (() -> Unit)? = null,
leadingContent: ListItemContent? = null, leadingContent: ListItemContent? = null,
@@ -57,19 +56,19 @@ fun ListItem(
enabled: Boolean = true, enabled: Boolean = true,
alwaysClickable: Boolean = false, alwaysClickable: Boolean = false,
onClick: (() -> Unit)? = null, onClick: (() -> Unit)? = null,
content: @Composable () -> Unit,
) { ) {
val colors = ListItemDefaults.colors( val colors = ListItemDefaults.colors(
containerColor = Color.Transparent, containerColor = Color.Transparent,
headlineColor = style.headlineColor(), headlineColor = style.contentColor(),
leadingIconColor = style.leadingIconColor(), leadingIconColor = style.leadingIconColor(),
trailingIconColor = style.trailingIconColor(), trailingIconColor = style.trailingIconColor(),
supportingColor = style.supportingTextColor(), supportingColor = style.supportingTextColor(),
disabledHeadlineColor = ListItemDefaultColors.headlineDisabled, disabledHeadlineColor = ListItemDefaultColors.contentDisabled,
disabledLeadingIconColor = ListItemDefaultColors.iconDisabled, disabledLeadingIconColor = ListItemDefaultColors.iconDisabled,
disabledTrailingIconColor = ListItemDefaultColors.iconDisabled, disabledTrailingIconColor = ListItemDefaultColors.iconDisabled,
) )
ListItem( ListItem(
headlineContent = headlineContent,
modifier = modifier, modifier = modifier,
supportingContent = supportingContent, supportingContent = supportingContent,
leadingContent = leadingContent, leadingContent = leadingContent,
@@ -78,25 +77,25 @@ fun ListItem(
enabled = enabled, enabled = enabled,
alwaysClickable = alwaysClickable, alwaysClickable = alwaysClickable,
onClick = onClick, onClick = onClick,
content = content,
) )
} }
/** /**
* A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines. * A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines.
* @param headlineContent The main content of the list item, usually a text.
* @param colors The colors to use for the list item. You can use [ListItemDefaults.colors] to create this. * @param colors The colors to use for the list item. You can use [ListItemDefaults.colors] to create this.
* @param modifier The modifier to be applied to the list item. * @param modifier The modifier to be applied to the list item.
* @param supportingContent The content to be displayed below the headline content. * @param supportingContent The content to be displayed below the content.
* @param leadingContent The content to be displayed before the headline content. * @param leadingContent The content to be displayed before the content.
* @param trailingContent The content to be displayed after the headline content. * @param trailingContent The content to be displayed after the content.
* @param enabled Whether the list item is enabled. When disabled, will change the color of the headline content and the leading content to use disabled tokens. * @param enabled Whether the list item is enabled. When disabled, will change the color of the content and the leading content to use disabled tokens.
* @param alwaysClickable Whether the list item should always be clickable, even when disabled. * @param alwaysClickable Whether the list item should always be clickable, even when disabled.
* @param onClick The callback to be called when the list item is clicked. * @param onClick The callback to be called when the list item is clicked.
* @param content The main content of the list item, usually a text.
*/ */
@Suppress("LongParameterList") @Suppress("LongParameterList")
@Composable @Composable
fun ListItem( fun ListItem(
headlineContent: @Composable () -> Unit,
colors: ListItemColors, colors: ListItemColors,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
supportingContent: @Composable (() -> Unit)? = null, supportingContent: @Composable (() -> Unit)? = null,
@@ -105,19 +104,20 @@ fun ListItem(
enabled: Boolean = true, enabled: Boolean = true,
alwaysClickable: Boolean = false, alwaysClickable: Boolean = false,
onClick: (() -> Unit)? = null, onClick: (() -> Unit)? = null,
content: @Composable () -> Unit,
) { ) {
// We cannot just pass the disabled colors, they must be set manually: https://issuetracker.google.com/issues/280480132 // We cannot just pass the disabled colors, they must be set manually: https://issuetracker.google.com/issues/280480132
val headlineColor = if (enabled) colors.contentColor else colors.disabledContentColor val contentColor = if (enabled) colors.contentColor else colors.disabledContentColor
val supportingColor = if (enabled) colors.supportingContentColor else colors.disabledContentColor.copy(alpha = 0.80f) val supportingColor = if (enabled) colors.supportingContentColor else colors.disabledContentColor.copy(alpha = 0.80f)
val leadingContentColor = if (enabled) colors.leadingContentColor else colors.disabledLeadingContentColor val leadingContentColor = if (enabled) colors.leadingContentColor else colors.disabledLeadingContentColor
val trailingContentColor = if (enabled) colors.trailingContentColor else colors.disabledTrailingContentColor val trailingContentColor = if (enabled) colors.trailingContentColor else colors.disabledTrailingContentColor
val decoratedHeadlineContent: @Composable () -> Unit = { val decoratedContent: @Composable () -> Unit = {
CompositionLocalProvider( CompositionLocalProvider(
LocalTextStyle provides ElementTheme.typography.fontBodyLgRegular, LocalTextStyle provides ElementTheme.typography.fontBodyLgRegular,
LocalContentColor provides headlineColor, LocalContentColor provides contentColor,
) { ) {
headlineContent() content()
} }
} }
val decoratedSupportingContent: (@Composable () -> Unit)? = supportingContent?.let { content -> val decoratedSupportingContent: (@Composable () -> Unit)? = supportingContent?.let { content ->
@@ -151,7 +151,6 @@ fun ListItem(
} }
androidx.compose.material3.ListItem( androidx.compose.material3.ListItem(
headlineContent = decoratedHeadlineContent,
modifier = if (onClick != null) { modifier = if (onClick != null) {
Modifier Modifier
.clickable(enabled = enabled || alwaysClickable, onClick = onClick) .clickable(enabled = enabled || alwaysClickable, onClick = onClick)
@@ -169,8 +168,8 @@ fun ListItem(
leadingContent = decoratedLeadingContent, leadingContent = decoratedLeadingContent,
trailingContent = decoratedTrailingContent, trailingContent = decoratedTrailingContent,
colors = colors, colors = colors,
tonalElevation = 0.dp, elevation = ListItemDefaults.elevation(elevation = 0.dp),
shadowElevation = 0.dp, content = decoratedContent,
) )
} }
@@ -223,8 +222,8 @@ sealed interface ListItemStyle {
data object Destructive : ListItemStyle data object Destructive : ListItemStyle
@Composable @Composable
fun headlineColor() = when (this) { fun contentColor() = when (this) {
Default, Primary -> ListItemDefaultColors.headline Default, Primary -> ListItemDefaultColors.content
Destructive -> ElementTheme.colors.textCriticalPrimary Destructive -> ElementTheme.colors.textCriticalPrimary
} }
@@ -251,8 +250,8 @@ sealed interface ListItemStyle {
} }
object ListItemDefaultColors { object ListItemDefaultColors {
val headline: Color @Composable get() = ElementTheme.colors.textPrimary val content: Color @Composable get() = ElementTheme.colors.textPrimary
val headlineDisabled: Color @Composable get() = ElementTheme.colors.textDisabled val contentDisabled: Color @Composable get() = ElementTheme.colors.textDisabled
val supportingText: Color @Composable get() = ElementTheme.materialColors.onSurfaceVariant val supportingText: Color @Composable get() = ElementTheme.materialColors.onSurfaceVariant
val leadingIcon: Color @Composable get() = ElementTheme.colors.iconSecondary val leadingIcon: Color @Composable get() = ElementTheme.colors.iconSecondary
val trailingIcon: Color @Composable get() = ElementTheme.colors.iconPrimary val trailingIcon: Color @Composable get() = ElementTheme.colors.iconPrimary
@@ -260,11 +259,11 @@ object ListItemDefaultColors {
val colors: ListItemColors val colors: ListItemColors
@Composable get() = ListItemDefaults.colors( @Composable get() = ListItemDefaults.colors(
headlineColor = headline, headlineColor = content,
supportingColor = supportingText, supportingColor = supportingText,
leadingIconColor = leadingIcon, leadingIconColor = leadingIcon,
trailingIconColor = trailingIcon, trailingIconColor = trailingIcon,
disabledHeadlineColor = headlineDisabled, disabledHeadlineColor = contentDisabled,
disabledLeadingIconColor = iconDisabled, disabledLeadingIconColor = iconDisabled,
disabledTrailingIconColor = iconDisabled, disabledTrailingIconColor = iconDisabled,
) )
@@ -523,7 +522,7 @@ private object PreviewItems {
) { ) {
EnabledDisabledElementThemedPreview { EnabledDisabledElementThemedPreview {
ListItem( ListItem(
headlineContent = headline(), content = content(),
supportingContent = text(), supportingContent = text(),
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = trailingContent, trailingContent = trailingContent,
@@ -543,7 +542,7 @@ private object PreviewItems {
) { ) {
EnabledDisabledElementThemedPreview { EnabledDisabledElementThemedPreview {
ListItem( ListItem(
headlineContent = headline(), content = content(),
supportingContent = textSingleLine(), supportingContent = textSingleLine(),
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = trailingContent, trailingContent = trailingContent,
@@ -563,7 +562,7 @@ private object PreviewItems {
) { ) {
EnabledDisabledElementThemedPreview { EnabledDisabledElementThemedPreview {
ListItem( ListItem(
headlineContent = headline(), content = content(),
leadingContent = leadingContent, leadingContent = leadingContent,
trailingContent = trailingContent, trailingContent = trailingContent,
enabled = it, enabled = it,
@@ -574,7 +573,7 @@ private object PreviewItems {
} }
@Composable @Composable
fun headline() = @Composable { fun content() = @Composable {
Text("List item") Text("List item")
} }
@@ -134,7 +134,7 @@ internal fun ListSupportingTextNoPaddingPreview() {
internal fun ListSupportingTextDefaultPaddingPreview() { internal fun ListSupportingTextDefaultPaddingPreview() {
ElementThemedPreview { ElementThemedPreview {
Column { Column {
ListItem(headlineContent = { Text("A title") }) ListItem(content = { Text("A title") })
ListSupportingText( ListSupportingText(
text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more", text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more",
contentPadding = ListSupportingTextDefaults.Padding.Default, contentPadding = ListSupportingTextDefaults.Padding.Default,
@@ -149,7 +149,7 @@ internal fun ListSupportingTextSmallPaddingPreview() {
ElementThemedPreview { ElementThemedPreview {
Column { Column {
ListItem( ListItem(
headlineContent = { Text("A title") }, content = { Text("A title") },
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ShareAndroid())) leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ShareAndroid()))
) )
ListSupportingText( ListSupportingText(
@@ -165,7 +165,7 @@ internal fun ListSupportingTextSmallPaddingPreview() {
internal fun ListSupportingTextLargePaddingPreview() { internal fun ListSupportingTextLargePaddingPreview() {
ElementThemedPreview { ElementThemedPreview {
Column { Column {
ListItem(headlineContent = { Text("A title") }, leadingContent = ListItemContent.Switch(checked = true)) ListItem(content = { Text("A title") }, leadingContent = ListItemContent.Switch(checked = true))
ListSupportingText( ListSupportingText(
text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more", text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more",
contentPadding = ListSupportingTextDefaults.Padding.LargeLeadingContent, contentPadding = ListSupportingTextDefaults.Padding.LargeLeadingContent,
@@ -179,7 +179,7 @@ internal fun ListSupportingTextLargePaddingPreview() {
internal fun ListSupportingTextCustomPaddingPreview() { internal fun ListSupportingTextCustomPaddingPreview() {
ElementThemedPreview { ElementThemedPreview {
Column { Column {
ListItem(headlineContent = { Text("A title") }) ListItem(content = { Text("A title") })
ListSupportingText( ListSupportingText(
text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more", text = "Supporting line text lorem ipsum dolor sit amet, consectetur. Read more",
contentPadding = ListSupportingTextDefaults.Padding.Custom(24.dp), contentPadding = ListSupportingTextDefaults.Padding.Custom(24.dp),
@@ -96,7 +96,7 @@ private fun AvatarActionBottomSheetContent(
) { action -> ) { action ->
ListItem( ListItem(
modifier = Modifier.clickable { onActionClick(action) }, modifier = Modifier.clickable { onActionClick(action) },
headlineContent = { content = {
Text( Text(
text = stringResource(action.titleResId), text = stringResource(action.titleResId),
style = ElementTheme.typography.fontBodyLgRegular, style = ElementTheme.typography.fontBodyLgRegular,
@@ -113,14 +113,14 @@ fun MediaDetailsBottomSheet(
} }
ListItem( ListItem(
leadingContent = icon, leadingContent = icon,
headlineContent = { Text(wording) }, content = { Text(wording) },
onClick = { onClick = {
onOpenWith(state.eventId) onOpenWith(state.eventId)
} }
) )
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VisibilityOn())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VisibilityOn())),
headlineContent = { Text(stringResource(CommonStrings.action_view_in_timeline)) }, content = { Text(stringResource(CommonStrings.action_view_in_timeline)) },
onClick = { onClick = {
onViewInTimeline(state.eventId) onViewInTimeline(state.eventId)
} }
@@ -128,14 +128,14 @@ fun MediaDetailsBottomSheet(
if (state.fromGallery) { if (state.fromGallery) {
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ShareAndroid())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.ShareAndroid())),
headlineContent = { Text(stringResource(CommonStrings.action_share)) }, content = { Text(stringResource(CommonStrings.action_share)) },
onClick = { onClick = {
onShare(state.eventId) onShare(state.eventId)
} }
) )
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Download())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Download())),
headlineContent = { Text(stringResource(CommonStrings.action_download)) }, content = { Text(stringResource(CommonStrings.action_download)) },
onClick = { onClick = {
onDownload(state.eventId) onDownload(state.eventId)
} }
@@ -143,7 +143,7 @@ fun MediaDetailsBottomSheet(
} }
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Forward())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Forward())),
headlineContent = { Text(stringResource(CommonStrings.action_forward)) }, content = { Text(stringResource(CommonStrings.action_forward)) },
onClick = { onClick = {
onForward(state.eventId) onForward(state.eventId)
} }
@@ -152,7 +152,7 @@ fun MediaDetailsBottomSheet(
HorizontalDivider() HorizontalDivider()
ListItem( ListItem(
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())), leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())),
headlineContent = { Text(stringResource(CommonStrings.action_delete_file)) }, content = { Text(stringResource(CommonStrings.action_delete_file)) },
style = ListItemStyle.Destructive, style = ListItemStyle.Destructive,
onClick = { onClick = {
onDelete(state.eventId) onDelete(state.eventId)
@@ -179,7 +179,7 @@ private fun EditLinkDialog(
} }
item { item {
ListItem( ListItem(
headlineContent = { content = {
Text( Text(
text = stringResource(R.string.rich_text_editor_remove_link), text = stringResource(R.string.rich_text_editor_remove_link),
color = ElementTheme.colors.textCriticalPrimary color = ElementTheme.colors.textCriticalPrimary
@@ -68,7 +68,7 @@ private fun ColumnScope.TroubleshootTestView(
val status = testState.status val status = testState.status
if ((status as? Status.Idle)?.visible == false) return if ((status as? Status.Idle)?.visible == false) return
ListItem( ListItem(
headlineContent = { Text(text = testState.name) }, content = { Text(text = testState.name) },
supportingContent = { Text(text = testState.description) }, supportingContent = { Text(text = testState.description) },
trailingContent = when (status) { trailingContent = when (status) {
is Status.Idle -> null is Status.Idle -> null
@@ -108,7 +108,7 @@ private fun ColumnScope.TroubleshootTestView(
) )
if (status is Status.Failure && status.hasQuickFix) { if (status is Status.Failure && status.hasQuickFix) {
ListItem( ListItem(
headlineContent = { }, content = { },
trailingContent = ListItemContent.Custom { trailingContent = ListItemContent.Custom {
Button( Button(
text = status.quickFixButtonString ?: stringResource(id = R.string.troubleshoot_notifications_screen_quick_fix_action), text = status.quickFixButtonString ?: stringResource(id = R.string.troubleshoot_notifications_screen_quick_fix_action),
@@ -137,7 +137,7 @@ private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNoti
} }
when (state.testSuiteState.mainState) { when (state.testSuiteState.mainState) {
AsyncAction.Uninitialized -> { AsyncAction.Uninitialized -> {
ListItem(headlineContent = { ListItem(content = {
Text( Text(
text = stringResource(id = R.string.troubleshoot_notifications_screen_notice) text = stringResource(id = R.string.troubleshoot_notifications_screen_notice)
) )
@@ -146,20 +146,20 @@ private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNoti
} }
AsyncAction.Loading -> Unit AsyncAction.Loading -> Unit
is AsyncAction.Failure -> { is AsyncAction.Failure -> {
ListItem(headlineContent = { ListItem(content = {
Text(text = stringResource(id = R.string.troubleshoot_notifications_screen_failure)) Text(text = stringResource(id = R.string.troubleshoot_notifications_screen_failure))
}) })
RunTestButton(state = state) RunTestButton(state = state)
} }
is AsyncAction.Confirming -> { is AsyncAction.Confirming -> {
ListItem(headlineContent = { ListItem(content = {
Text( Text(
text = stringResource(id = R.string.troubleshoot_notifications_screen_waiting) text = stringResource(id = R.string.troubleshoot_notifications_screen_waiting)
) )
}) })
} }
is AsyncAction.Success -> { is AsyncAction.Success -> {
ListItem(headlineContent = { ListItem(content = {
Text( Text(
text = stringResource(id = R.string.troubleshoot_notifications_screen_success) text = stringResource(id = R.string.troubleshoot_notifications_screen_success)
) )
@@ -171,7 +171,7 @@ private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNoti
@Composable @Composable
private fun RunTestButton(state: TroubleshootNotificationsState) { private fun RunTestButton(state: TroubleshootNotificationsState) {
ListItem( ListItem(
headlineContent = { content = {
Button( Button(
text = stringResource( text = stringResource(
id = if (state.testSuiteState.mainState is AsyncAction.Failure) { id = if (state.testSuiteState.mainState is AsyncAction.Failure) {
@@ -156,7 +156,7 @@ private fun PushHistoryContent(
modifier = modifier.fillMaxWidth() modifier = modifier.fillMaxWidth()
) { ) {
ListItem( ListItem(
headlineContent = { Text("Total number of received push") }, content = { Text("Total number of received push") },
trailingContent = ListItemContent.Text(state.pushCounter.toString()), trailingContent = ListItemContent.Text(state.pushCounter.toString()),
) )
LazyColumn( LazyColumn(