Let Preference composables use ListItem.
Let PreferenceCheckbox use ListItem and add missing previews. Let PreferenceCategory use ListSectionHeader Let PreferenceSlide use ListItem Let PreferenceRow use ListItem Let PreferenceText use ListItem
This commit is contained in:
parent
8f6190ebbc
commit
34f7819702
15 changed files with 232 additions and 260 deletions
|
|
@ -48,7 +48,10 @@ fun DeveloperSettingsView(
|
|||
title = stringResource(id = CommonStrings.common_developer_options)
|
||||
) {
|
||||
// Note: this is OK to hardcode strings in this debug screen.
|
||||
PreferenceCategory(title = "Feature flags") {
|
||||
PreferenceCategory(
|
||||
title = "Feature flags",
|
||||
showTopDivider = false,
|
||||
) {
|
||||
FeatureListContent(state)
|
||||
}
|
||||
ElementCallCategory(state = state)
|
||||
|
|
@ -67,14 +70,14 @@ fun DeveloperSettingsView(
|
|||
RageshakePreferencesView(
|
||||
state = state.rageshakeState,
|
||||
)
|
||||
PreferenceCategory(title = "Crash", showDivider = false) {
|
||||
PreferenceCategory(title = "Crash", showTopDivider = false) {
|
||||
PreferenceText(
|
||||
title = "Crash the app 💥",
|
||||
onClick = { error("This crash is a test.") }
|
||||
)
|
||||
}
|
||||
val cache = state.cacheSize
|
||||
PreferenceCategory(title = "Cache", showDivider = false) {
|
||||
PreferenceCategory(title = "Cache", showTopDivider = false) {
|
||||
PreferenceText(
|
||||
title = "Clear cache",
|
||||
currentValue = cache.dataOrNull(),
|
||||
|
|
@ -93,11 +96,12 @@ fun DeveloperSettingsView(
|
|||
private fun ElementCallCategory(
|
||||
state: DeveloperSettingsState,
|
||||
) {
|
||||
PreferenceCategory(title = "Element Call", showDivider = true) {
|
||||
PreferenceCategory(title = "Element Call", showTopDivider = true) {
|
||||
val callUrlState = state.customElementCallBaseUrlState
|
||||
fun isUsingDefaultUrl(value: String?): Boolean {
|
||||
return value.isNullOrEmpty() || value == callUrlState.defaultUrl
|
||||
}
|
||||
|
||||
val supportingText = if (isUsingDefaultUrl(callUrlState.baseUrl)) {
|
||||
stringResource(R.string.screen_advanced_settings_element_call_base_url_description)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package io.element.android.features.preferences.impl.notifications
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
|
@ -121,7 +120,6 @@ private fun NotificationSettingsContentView(
|
|||
PreferenceSwitch(
|
||||
title = stringResource(id = R.string.screen_notification_settings_enable_notifications),
|
||||
isChecked = systemSettings.appNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onNotificationsEnabledChanged
|
||||
)
|
||||
|
||||
|
|
@ -145,7 +143,6 @@ private fun NotificationSettingsContentView(
|
|||
modifier = Modifier,
|
||||
title = stringResource(id = R.string.screen_notification_settings_room_mention_label),
|
||||
isChecked = matrixSettings.atRoomNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onMentionNotificationsChanged
|
||||
)
|
||||
}
|
||||
|
|
@ -162,7 +159,6 @@ private fun NotificationSettingsContentView(
|
|||
modifier = Modifier,
|
||||
title = stringResource(id = R.string.screen_notification_settings_invite_for_me_label),
|
||||
isChecked = matrixSettings.inviteForMeNotificationsEnabled,
|
||||
switchAlignment = Alignment.Top,
|
||||
onCheckedChange = onInviteForMeNotificationsChanged
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ fun EditDefaultNotificationSettingView(
|
|||
} else {
|
||||
R.string.screen_notification_settings_edit_screen_group_section_header
|
||||
}
|
||||
PreferenceCategory(title = stringResource(id = categoryTitle)) {
|
||||
PreferenceCategory(
|
||||
title = stringResource(id = categoryTitle),
|
||||
showTopDivider = false,
|
||||
) {
|
||||
if (state.mode != null) {
|
||||
Column(modifier = Modifier.selectableGroup()) {
|
||||
validModes.forEach { item ->
|
||||
|
|
@ -83,7 +86,7 @@ fun EditDefaultNotificationSettingView(
|
|||
}
|
||||
}
|
||||
if (state.roomsWithUserDefinedMode.isNotEmpty()) {
|
||||
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_edit_custom_settings_section_title)) {
|
||||
PreferenceCategory(title = stringResource(id = R.string.screen_notification_settings_edit_custom_settings_section_title),) {
|
||||
state.roomsWithUserDefinedMode.forEach { summary ->
|
||||
val subtitle = when (summary.details.userDefinedNotificationMode) {
|
||||
RoomNotificationMode.ALL_MESSAGES -> stringResource(id = R.string.screen_notification_settings_edit_mode_all_messages)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue