Skip to content

Commit

Permalink
feat(settings): add some icons to settings entries
Browse files Browse the repository at this point in the history
  • Loading branch information
outadoc committed Apr 23, 2023
1 parent ee02b63 commit ea37e84
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,7 +23,6 @@ import fr.outadoc.justchatting.utils.ui.isLaunchedFromBubbleCompat

class DefaultChatNotifier(
private val context: Context,
private val preferenceRepository: PreferenceRepository,
) : ChatNotifier {

companion object {
Expand Down
1 change: 1 addition & 0 deletions feature-preferences-presentation-mobile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
},
)
}

Expand Down Expand Up @@ -269,6 +279,12 @@ fun SettingsList(
title = {
Text(text = stringResource(R.string.settings_notifications_openNotificationsSettings))
},
trailingIcon = {
Icon(
imageVector = Icons.Default.OpenInNew,
contentDescription = null,
)
},
)
}

Expand All @@ -281,6 +297,12 @@ fun SettingsList(
title = {
Text(text = stringResource(R.string.settings_notifications_openBubbleSettings))
},
trailingIcon = {
Icon(
imageVector = Icons.Default.OpenInNew,
contentDescription = null,
)
},
)
}
}
Expand Down Expand Up @@ -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,
)
},
)
}

Expand Down Expand Up @@ -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,
)
},
)
}

Expand Down Expand Up @@ -445,6 +479,14 @@ fun SettingsList(
Text(text = license)
}
},
trailingIcon = {
if (dependency.moduleUrl != null) {
Icon(
imageVector = Icons.Default.OpenInNew,
contentDescription = null,
)
}
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,6 +60,7 @@ fun SettingsText(
onClickLabel: String? = null,
title: @Composable () -> Unit,
subtitle: @Composable () -> Unit = {},
trailingIcon: @Composable () -> Unit = {},
) {
Box(
modifier = Modifier
Expand All @@ -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()
}
}
}

0 comments on commit ea37e84

Please sign in to comment.