From ea37e8448978d12487291f1f87f327a2820b7418 Mon Sep 17 00:00:00 2001 From: Baptiste Candellier Date: Sun, 23 Apr 2023 20:49:46 +0200 Subject: [PATCH] feat(settings): add some icons to settings entries --- .../mobile/DefaultChatNotifier.kt | 2 - .../build.gradle.kts | 1 + .../presentation/mobile/SettingsList.kt | 42 +++++++++++++++++++ .../presentation/mobile/SettingsText.kt | 32 +++++++++----- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/feature-chat-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/chat/presentation/mobile/DefaultChatNotifier.kt b/feature-chat-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/chat/presentation/mobile/DefaultChatNotifier.kt index 36ade31ef..56e8c29b3 100644 --- a/feature-chat-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/chat/presentation/mobile/DefaultChatNotifier.kt +++ b/feature-chat-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/chat/presentation/mobile/DefaultChatNotifier.kt @@ -13,7 +13,6 @@ import androidx.core.app.RemoteInput import androidx.core.content.ContextCompat import androidx.core.content.LocusIdCompat import fr.outadoc.justchatting.component.chatapi.domain.model.User -import fr.outadoc.justchatting.component.preferences.domain.PreferenceRepository import fr.outadoc.justchatting.feature.chat.data.getProfileImageIcon import fr.outadoc.justchatting.feature.chat.presentation.ChatConnectionService import fr.outadoc.justchatting.feature.chat.presentation.ChatNotifier @@ -24,7 +23,6 @@ import fr.outadoc.justchatting.utils.ui.isLaunchedFromBubbleCompat class DefaultChatNotifier( private val context: Context, - private val preferenceRepository: PreferenceRepository, ) : ChatNotifier { companion object { diff --git a/feature-preferences-presentation-mobile/build.gradle.kts b/feature-preferences-presentation-mobile/build.gradle.kts index dc313cef7..eb1d587f0 100644 --- a/feature-preferences-presentation-mobile/build.gradle.kts +++ b/feature-preferences-presentation-mobile/build.gradle.kts @@ -52,6 +52,7 @@ dependencies { implementation(libs.kotlinx.coroutines) implementation(libs.compose.foundation) implementation(libs.compose.material.core3) + implementation(libs.compose.material.icons) implementation(libs.compose.ui.core) implementation(libs.compose.ui.tooling) implementation(libs.kotlinx.datetime) diff --git a/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsList.kt b/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsList.kt index 507b54497..133e9608e 100644 --- a/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsList.kt +++ b/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsList.kt @@ -7,7 +7,11 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.OpenInNew +import androidx.compose.material.icons.filled.Share import androidx.compose.material3.AlertDialog +import androidx.compose.material3.Icon import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -175,6 +179,12 @@ fun SettingsList( onClick = { uriHandler.openUri(pronounsUrl) }, onClickLabel = stringResource(id = R.string.settings_thirdparty_pronouns_set_cd), title = { Text(text = stringResource(id = R.string.settings_thirdparty_pronouns_set_title)) }, + trailingIcon = { + Icon( + imageVector = Icons.Default.OpenInNew, + contentDescription = null, + ) + }, ) } @@ -269,6 +279,12 @@ fun SettingsList( title = { Text(text = stringResource(R.string.settings_notifications_openNotificationsSettings)) }, + trailingIcon = { + Icon( + imageVector = Icons.Default.OpenInNew, + contentDescription = null, + ) + }, ) } @@ -281,6 +297,12 @@ fun SettingsList( title = { Text(text = stringResource(R.string.settings_notifications_openBubbleSettings)) }, + trailingIcon = { + Icon( + imageVector = Icons.Default.OpenInNew, + contentDescription = null, + ) + }, ) } } @@ -384,6 +406,12 @@ fun SettingsList( onClickLabel = stringResource(id = R.string.settings_about_repo_cd), title = { Text(text = stringResource(id = R.string.settings_about_repo_title)) }, subtitle = { Text(text = stringResource(id = R.string.app_repo_name)) }, + trailingIcon = { + Icon( + imageVector = Icons.Default.OpenInNew, + contentDescription = null, + ) + }, ) } @@ -412,6 +440,12 @@ fun SettingsList( title = { Text(text = stringResource(R.string.settings_logs_title)) }, onClick = onShareLogsClick, subtitle = { Text(text = stringResource(R.string.settings_logs_subtitle)) }, + trailingIcon = { + Icon( + imageVector = Icons.Default.Share, + contentDescription = null, + ) + }, ) } @@ -445,6 +479,14 @@ fun SettingsList( Text(text = license) } }, + trailingIcon = { + if (dependency.moduleUrl != null) { + Icon( + imageVector = Icons.Default.OpenInNew, + contentDescription = null, + ) + } + }, ) } } diff --git a/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsText.kt b/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsText.kt index 65be7ae25..e9cf66b56 100644 --- a/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsText.kt +++ b/feature-preferences-presentation-mobile/src/main/java/fr/outadoc/justchatting/feature/preferences/presentation/mobile/SettingsText.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width @@ -59,6 +60,7 @@ fun SettingsText( onClickLabel: String? = null, title: @Composable () -> Unit, subtitle: @Composable () -> Unit = {}, + trailingIcon: @Composable () -> Unit = {}, ) { Box( modifier = Modifier @@ -67,22 +69,30 @@ fun SettingsText( .padding(vertical = 16.dp), contentAlignment = Alignment.CenterStart, ) { - Column( + Row( modifier = modifier, - verticalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp), + verticalAlignment = Alignment.CenterVertically, ) { - CompositionLocalProvider( - LocalTextStyle provides MaterialTheme.typography.titleMedium, + Column( + modifier = Modifier.weight(1f, fill = true), + verticalArrangement = Arrangement.spacedBy(4.dp), ) { - title() - } + CompositionLocalProvider( + LocalTextStyle provides MaterialTheme.typography.titleMedium, + ) { + title() + } - CompositionLocalProvider( - LocalTextStyle provides MaterialTheme.typography.bodySmall, - LocalContentColor provides LocalContentColor.current.copy(alpha = 0.8f), - ) { - subtitle() + CompositionLocalProvider( + LocalTextStyle provides MaterialTheme.typography.bodySmall, + LocalContentColor provides LocalContentColor.current.copy(alpha = 0.8f), + ) { + subtitle() + } } + + trailingIcon() } } }