From 97c31d0e3e9d5a66664f60c3b742c7095ed41fa4 Mon Sep 17 00:00:00 2001 From: Infi Date: Sun, 22 Oct 2023 22:38:45 +0200 Subject: [PATCH] feat: add explainers for certain statuses Signed-off-by: Infi --- .../settings/profile/StatusPicker.kt | 25 +++++++++++++++++-- app/src/main/res/values/strings.xml | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/chat/revolt/components/settings/profile/StatusPicker.kt b/app/src/main/java/chat/revolt/components/settings/profile/StatusPicker.kt index c253a6ab..aaef0293 100644 --- a/app/src/main/java/chat/revolt/components/settings/profile/StatusPicker.kt +++ b/app/src/main/java/chat/revolt/components/settings/profile/StatusPicker.kt @@ -16,6 +16,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import chat.revolt.R import chat.revolt.components.generic.Presence @@ -31,6 +33,16 @@ fun Presence.stringResource(): Int { } } +fun Presence.explainerResource(): Int? { + return when (this) { + Presence.Online -> null + Presence.Idle -> null + Presence.Dnd -> R.string.status_dnd_explainer + Presence.Focus -> R.string.status_focus_explainer + Presence.Offline -> R.string.status_invisible_explainer + } +} + @Composable fun StatusPicker( currentStatus: Presence, @@ -49,7 +61,6 @@ fun StatusPicker( Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier .clip(MaterialTheme.shapes.small) .background(MaterialTheme.colorScheme.surfaceColorAtElevation(2.dp)) @@ -66,8 +77,18 @@ fun StatusPicker( Text( text = stringResource(currentStatus.stringResource()), - style = MaterialTheme.typography.bodyLarge + style = MaterialTheme.typography.bodyLarge.copy( + fontWeight = FontWeight.Bold + ) ) + + currentStatus.explainerResource()?.let { + Text( + text = stringResource(it), + style = MaterialTheme.typography.bodyMedium, + textAlign = TextAlign.Center + ) + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 354ad160..abfed8ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -185,9 +185,12 @@ Online Idle Focus + You will not receive any notifications for messages, but you will receive notifications for @mentions. Do Not Disturb + You will not receive any notifications, including messages and @mentions. Offline Invisible + You will be able to use Revolt as usual, but you will not appear as online to other people. No connection You are not connected to the internet. Please check your connection and try again.