Add room notification settings (#807)

* Add room notification settings

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: David Langley <langley.dave@gmail.com>
This commit is contained in:
Yoan Pintas 2023-09-07 08:24:34 +00:00 committed by GitHub
parent a40c9ef002
commit 4a5a01d710
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 1381 additions and 70 deletions

View file

@ -39,6 +39,8 @@ import io.element.android.libraries.designsystem.preview.ElementThemedPreview
import io.element.android.libraries.designsystem.preview.PreviewGroup
import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.toEnabledColor
import io.element.android.libraries.designsystem.toSecondaryEnabledColor
import io.element.android.libraries.theme.ElementTheme
/**
@ -48,6 +50,7 @@ import io.element.android.libraries.theme.ElementTheme
fun PreferenceText(
title: String,
modifier: Modifier = Modifier,
enabled: Boolean = true,
subtitle: String? = null,
currentValue: String? = null,
loadingCurrentValue: Boolean = false,
@ -68,8 +71,9 @@ fun PreferenceText(
) {
PreferenceIcon(
icon = icon,
enabled = enabled,
isVisible = showIconAreaIfNoIcon,
tintColor = tintColor ?: ElementTheme.materialColors.secondary
tintColor = tintColor ?: enabled.toSecondaryEnabledColor(),
)
Column(
modifier = Modifier
@ -79,13 +83,13 @@ fun PreferenceText(
Text(
style = ElementTheme.typography.fontBodyLgRegular,
text = title,
color = tintColor ?: ElementTheme.materialColors.primary,
color = tintColor ?: enabled.toEnabledColor(),
)
if (subtitle != null) {
Text(
style = ElementTheme.typography.fontBodyMdRegular,
text = subtitle,
color = tintColor ?: ElementTheme.materialColors.secondary,
color = tintColor ?: enabled.toSecondaryEnabledColor(),
)
}
}
@ -96,7 +100,7 @@ fun PreferenceText(
.padding(start = 16.dp, end = 8.dp),
text = currentValue,
style = ElementTheme.typography.fontBodyXsMedium,
color = ElementTheme.materialColors.secondary,
color = enabled.toSecondaryEnabledColor(),
)
} else if (loadingCurrentValue) {
CircularProgressIndicator(
@ -135,6 +139,13 @@ private fun ContentToPreview() {
icon = Icons.Default.BugReport,
currentValue = "123",
)
PreferenceText(
title = "Title",
subtitle = "Some content",
icon = Icons.Default.BugReport,
currentValue = "123",
enabled = false,
)
PreferenceText(
title = "Title",
subtitle = "Some content",