mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Fix deprecation warning on androidx.compose.material3.ListItem
This commit is contained in:
committed by
Benoit Marty
parent
d2b4a85453
commit
d1cf1aa09f
+2
-2
@@ -34,14 +34,14 @@ fun AboutView(
|
||||
) {
|
||||
state.elementLegals.forEach { elementLegal ->
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = elementLegal.titleRes))
|
||||
},
|
||||
onClick = { onElementLegalClick(elementLegal) }
|
||||
)
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = CommonStrings.common_open_source_licenses))
|
||||
},
|
||||
onClick = onOpenSourceLicensesClick,
|
||||
|
||||
+9
-9
@@ -93,7 +93,7 @@ fun AdvancedSettingsView(
|
||||
}
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = CommonStrings.action_view_source))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -105,7 +105,7 @@ fun AdvancedSettingsView(
|
||||
onClick = { state.eventSink(AdvancedSettingsEvents.SetDeveloperModeEnabled(!state.isDeveloperModeEnabled)) }
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = R.string.screen_advanced_settings_share_presence))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -122,7 +122,7 @@ fun AdvancedSettingsView(
|
||||
null -> Unit
|
||||
is MediaOptimizationState.AllMedia -> {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = R.string.screen_advanced_settings_media_compression_title))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -146,7 +146,7 @@ fun AdvancedSettingsView(
|
||||
}
|
||||
is MediaOptimizationState.Split -> {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_image_upload_quality_title))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -171,7 +171,7 @@ fun AdvancedSettingsView(
|
||||
var displaySelectorDialog by remember { mutableStateOf(false) }
|
||||
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = R.string.screen_advanced_settings_optimise_video_upload_quality_title))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -247,7 +247,7 @@ private fun VideoQualitySelectorDialog(
|
||||
VideoCompressionPreset.HIGH -> stringResource(CommonStrings.common_video_quality_high_description)
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(
|
||||
text = title,
|
||||
style = ElementTheme.typography.fontBodyLgMedium,
|
||||
@@ -301,7 +301,7 @@ private fun ModerationAndSafety(
|
||||
}
|
||||
)
|
||||
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(
|
||||
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Off,
|
||||
compact = true
|
||||
@@ -312,7 +312,7 @@ private fun ModerationAndSafety(
|
||||
enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading()
|
||||
)
|
||||
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(
|
||||
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.Private,
|
||||
compact = true
|
||||
@@ -323,7 +323,7 @@ private fun ModerationAndSafety(
|
||||
enabled = !state.mediaPreviewConfigState.setTimelineMediaPreviewAction.isLoading()
|
||||
)
|
||||
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(
|
||||
selected = state.mediaPreviewConfigState.timelineMediaPreviewValue == MediaPreviewValue.On,
|
||||
compact = true
|
||||
|
||||
+7
-7
@@ -85,7 +85,7 @@ fun DeveloperSettingsView(
|
||||
if (state.isEnterpriseBuild) {
|
||||
PreferenceCategory(title = "Theme") {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Change brand color")
|
||||
},
|
||||
onClick = {
|
||||
@@ -93,7 +93,7 @@ fun DeveloperSettingsView(
|
||||
}
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Reset brand color")
|
||||
},
|
||||
onClick = {
|
||||
@@ -108,7 +108,7 @@ fun DeveloperSettingsView(
|
||||
val cache = state.cacheSize
|
||||
PreferenceCategory(title = "Cache") {
|
||||
ListItem(
|
||||
headlineContent = { Text("Database sizes") },
|
||||
content = { Text("Database sizes") },
|
||||
supportingContent = {
|
||||
if (state.databaseSizes.isLoading()) {
|
||||
Text("Computing...")
|
||||
@@ -127,7 +127,7 @@ fun DeveloperSettingsView(
|
||||
}
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Vacuum stores")
|
||||
},
|
||||
onClick = {
|
||||
@@ -135,7 +135,7 @@ fun DeveloperSettingsView(
|
||||
}
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Clear cache")
|
||||
},
|
||||
trailingContent = if (state.cacheSize.isLoading() || state.clearCacheAction.isLoading()) {
|
||||
@@ -194,7 +194,7 @@ private fun SessionCategory(deviceId: DeviceId) {
|
||||
private fun MarkAllRoomsAsReadCategory(state: DeveloperSettingsState) {
|
||||
PreferenceCategory(title = "Room list") {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Mark all rooms as read")
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -220,7 +220,7 @@ private fun MarkAllRoomsAsReadCategory(state: DeveloperSettingsState) {
|
||||
private fun NotificationCategory(onPushHistoryClick: () -> Unit) {
|
||||
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_title)) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(R.string.troubleshoot_notifications_entry_point_push_history_title))
|
||||
},
|
||||
onClick = onPushHistoryClick,
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ fun AppDeveloperSettingsView(
|
||||
}
|
||||
PreferenceCategory(title = "Showkase") {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Open Showkase browser")
|
||||
},
|
||||
onClick = onOpenShowkase
|
||||
@@ -95,7 +95,7 @@ fun AppDeveloperSettingsView(
|
||||
)
|
||||
PreferenceCategory(title = "Crash") {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text("Crash the app 💥")
|
||||
},
|
||||
onClick = { error("This crash is a test.") }
|
||||
|
||||
+9
-9
@@ -130,7 +130,7 @@ private fun NotificationSettingsContentView(
|
||||
if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) {
|
||||
ListItem(
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.NotificationsOffSolid())),
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = R.string.screen_notification_settings_system_notifications_turned_off))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -158,7 +158,7 @@ private fun NotificationSettingsContentView(
|
||||
PreferenceCategory {
|
||||
ListItem(
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.VoiceCallSolid())),
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = R.string.full_screen_intent_banner_title))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -172,7 +172,7 @@ private fun NotificationSettingsContentView(
|
||||
}
|
||||
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_notification_section_title)) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = R.string.screen_notification_settings_group_chats))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -181,7 +181,7 @@ private fun NotificationSettingsContentView(
|
||||
onClick = onGroupChatsClick
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = R.string.screen_notification_settings_direct_chats))
|
||||
},
|
||||
supportingContent = {
|
||||
@@ -218,7 +218,7 @@ private fun NotificationSettingsContentView(
|
||||
}
|
||||
PreferenceCategory(title = stringResource(id = R.string.troubleshoot_notifications_entry_point_section)) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(id = R.string.troubleshoot_notifications_entry_point_title))
|
||||
},
|
||||
onClick = onTroubleshootNotificationsClick
|
||||
@@ -227,7 +227,7 @@ private fun NotificationSettingsContentView(
|
||||
if (state.showAdvancedSettings) {
|
||||
PreferenceCategory(title = stringResource(id = CommonStrings.common_advanced_settings)) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(text = stringResource(id = R.string.screen_advanced_settings_push_provider_android))
|
||||
},
|
||||
trailingContent = when (state.currentPushDistributor) {
|
||||
@@ -296,7 +296,7 @@ private fun SoundsPreferenceCategory(state: NotificationSettingsState) {
|
||||
}
|
||||
}
|
||||
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) },
|
||||
onClick = { state.eventSink(NotificationSettingsEvents.ShowMessageSoundDialog) },
|
||||
)
|
||||
@@ -323,7 +323,7 @@ private fun SoundsPreferenceCategory(state: NotificationSettingsState) {
|
||||
}
|
||||
}
|
||||
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) },
|
||||
onClick = { state.eventSink(NotificationSettingsEvents.ShowCallRingtoneDialog) },
|
||||
)
|
||||
@@ -418,7 +418,7 @@ private fun SoundCopyErrorRow(
|
||||
modifier = Modifier
|
||||
.background(ElementTheme.colors.bgSubtleSecondary)
|
||||
.semantics { liveRegion = LiveRegionMode.Polite },
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(
|
||||
text = stringResource(R.string.screen_notification_settings_sound_set_sound_error_title),
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ fun DefaultNotificationSettingOption(
|
||||
}
|
||||
ListItem(
|
||||
modifier = modifier,
|
||||
headlineContent = { Text(title) },
|
||||
content = { Text(title) },
|
||||
supportingContent = subtitle?.let { { Text(it) } },
|
||||
trailingContent = ListItemContent.RadioButton(selected = isSelected),
|
||||
onClick = { onSelectOption(mode) },
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ fun EditDefaultNotificationSettingView(
|
||||
null -> ""
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
content = {
|
||||
val roomName = summary.name
|
||||
Text(
|
||||
text = roomName ?: stringResource(id = CommonStrings.common_no_room_name),
|
||||
|
||||
+15
-15
@@ -182,7 +182,7 @@ private fun ColumnScope.MultiAccountSection(
|
||||
}
|
||||
ListItem(
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Plus())),
|
||||
headlineContent = {
|
||||
content = {
|
||||
Text(stringResource(CommonStrings.common_add_another_account))
|
||||
},
|
||||
onClick = onAddAccountClick,
|
||||
@@ -201,18 +201,18 @@ private fun ColumnScope.ManageAppSection(
|
||||
onSecureBackupClick: () -> Unit,
|
||||
) {
|
||||
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())),
|
||||
onClick = onOpenNotificationSettings,
|
||||
)
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_screen_lock)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_screen_lock)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Lock())),
|
||||
onClick = onOpenLockScreenSettings,
|
||||
)
|
||||
if (state.showSecureBackup) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_encryption)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_encryption)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Key())),
|
||||
trailingContent = ListItemContent.Badge.takeIf { state.showSecureBackupBadge },
|
||||
onClick = onSecureBackupClick,
|
||||
@@ -230,7 +230,7 @@ private fun ColumnScope.ManageAccountSection(
|
||||
) {
|
||||
state.accountManagementUrl?.let { url ->
|
||||
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())),
|
||||
trailingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.PopOut())),
|
||||
onClick = { onManageAccountClick(url) },
|
||||
@@ -238,14 +238,14 @@ private fun ColumnScope.ManageAccountSection(
|
||||
}
|
||||
if (state.showLinkNewDevice) {
|
||||
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())),
|
||||
onClick = onLinkNewDeviceClick,
|
||||
)
|
||||
}
|
||||
if (state.showBlockedUsersItem) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_blocked_users)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_blocked_users)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Block())),
|
||||
onClick = onOpenBlockedUsers,
|
||||
trailingContent = ListItemContent.Text(state.nbOfBlockedUsers.toString()),
|
||||
@@ -269,46 +269,46 @@ private fun ColumnScope.GeneralSection(
|
||||
onDeactivateClick: () -> Unit,
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_advanced_settings)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_advanced_settings)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Settings())),
|
||||
onClick = onOpenAdvancedSettings,
|
||||
)
|
||||
if (state.showLabsItem) {
|
||||
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())),
|
||||
onClick = onOpenLabs,
|
||||
)
|
||||
}
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_about)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_about)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Info())),
|
||||
onClick = onOpenAbout,
|
||||
)
|
||||
if (state.canReportBug) {
|
||||
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())),
|
||||
onClick = onOpenRageShake
|
||||
)
|
||||
}
|
||||
if (state.showAnalyticsSettings) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_analytics)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_analytics)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Chart())),
|
||||
onClick = onOpenAnalytics,
|
||||
)
|
||||
}
|
||||
HorizontalDivider()
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.action_signout)) },
|
||||
content = { Text(stringResource(id = CommonStrings.action_signout)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Close())),
|
||||
style = ListItemStyle.Destructive,
|
||||
onClick = onSignOutClick,
|
||||
)
|
||||
if (state.canDeactivateAccount) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.action_delete_account)) },
|
||||
content = { Text(stringResource(id = CommonStrings.action_delete_account)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Delete())),
|
||||
style = ListItemStyle.Destructive,
|
||||
onClick = onDeactivateClick,
|
||||
@@ -340,7 +340,7 @@ private fun ColumnScope.Footer(
|
||||
@Composable
|
||||
private fun DeveloperPreferencesView(onOpenDeveloperSettings: () -> Unit) {
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(id = CommonStrings.common_developer_options)) },
|
||||
content = { Text(stringResource(id = CommonStrings.common_developer_options)) },
|
||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Code())),
|
||||
onClick = onOpenDeveloperSettings
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user