From f7396503b26a97a8cb07aaedee681f2fd339e686 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 13 Jun 2024 09:14:56 +0930 Subject: [PATCH] Use session colors --- .../securesms/home/HomeActivity.kt | 8 ++++++-- .../thoughtcrime/securesms/ui/Components.kt | 3 ++- .../org/thoughtcrime/securesms/ui/Themes.kt | 1 + .../securesms/ui/components/Button.kt | 18 +++++++++--------- .../securesms/ui/components/SessionTabRow.kt | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt index fa385c1bb1..5ebe4ca14e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -94,6 +94,7 @@ import org.thoughtcrime.securesms.permissions.Permissions import org.thoughtcrime.securesms.preferences.SettingsActivity import org.thoughtcrime.securesms.showMuteDialog import org.thoughtcrime.securesms.showSessionDialog +import org.thoughtcrime.securesms.ui.LocalColors import org.thoughtcrime.securesms.ui.LocalDimensions import org.thoughtcrime.securesms.ui.PreviewTheme import org.thoughtcrime.securesms.ui.SessionColors @@ -438,12 +439,15 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), Text( stringResource(R.string.welcome_to_session), style = MaterialTheme.typography.base, - color = MaterialTheme.colors.secondary, + color = LocalColors.current.primary, textAlign = TextAlign.Center ) } - Divider(modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall)) + Divider( + modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall), + color = LocalColors.current.borders + ) Text( stringResource(R.string.conversationsNone), style = MaterialTheme.typography.h8, diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt index 4b4c5d1c5b..56dafec938 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -321,6 +321,7 @@ fun Modifier.fadingEdges( fun Divider() { androidx.compose.material.Divider( modifier = Modifier.padding(horizontal = 16.dp), + color = LocalColors.current.divider ) } @@ -362,7 +363,7 @@ fun Arc( modifier: Modifier = Modifier, percentage: Float = 0.25f, fillColor: Color = LocalColors.current.primary, - backgroundColor: Color = classicDarkColors[3], + backgroundColor: Color = LocalColors.current.borders, strokeWidth: Dp = 18.dp, sweepAngle: Float = 310f, startAngle: Float = (360f - sweepAngle) / 2 + 90f diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt index e2f9654915..30d04197fe 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt @@ -71,6 +71,7 @@ data class SessionColors( val backgroundBubbleReceived: Color = Color.Unspecified, val textBubbleReceived: Color = Color.Unspecified, ) { + val button get() = if (isLight) text else primary val divider get() = text.copy(alpha = TabRowDefaults.DividerOpacity) val backgroundBubbleSent get() = primary } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt index dfe783de01..e956ba8248 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt @@ -62,7 +62,7 @@ val smallButton = Modifier.wrapContentHeight() fun SessionButtonText( text: String, modifier: Modifier = Modifier, - color: Color = LocalColors.current.primary, + color: Color = LocalColors.current.text, enabled: Boolean = true ) { Text( @@ -77,7 +77,7 @@ fun SessionButtonText( fun OutlineButton( @StringRes textId: Int, modifier: Modifier = Modifier, - color: Color = LocalColors.current.primary, + color: Color = LocalColors.current.button, onClick: () -> Unit ) { OutlineButton(stringResource(textId), modifier, color, onClick) } @@ -85,7 +85,7 @@ fun OutlineButton( fun OutlineButton( text: String, modifier: Modifier = Modifier, - color: Color = LocalColors.current.primary, + color: Color = LocalColors.current.button, onClick: () -> Unit ) { OutlineButton( @@ -102,7 +102,7 @@ fun OutlineButton( modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - color: Color = LocalColors.current.primary, + color: Color = LocalColors.current.button, onClick: () -> Unit, content: @Composable () -> Unit = {} ) { @@ -124,7 +124,7 @@ fun OutlineButton( @Composable fun OutlineCopyButton( modifier: Modifier = Modifier, - color: Color = LocalColors.current.primary, + color: Color = LocalColors.current.button, onClick: () -> Unit = {} ) { val interactionSource = remember { MutableInteractionSource() } @@ -215,7 +215,7 @@ fun FilledButton( @Composable fun BorderlessButton( modifier: Modifier = Modifier, - contentColor: Color = MaterialTheme.colors.onBackground, + contentColor: Color = LocalColors.current.text, backgroundColor: Color = Color.Transparent, onClick: () -> Unit, content: @Composable () -> Unit @@ -235,7 +235,7 @@ fun BorderlessButton( text: String, modifier: Modifier = Modifier, contentDescription: GetString = GetString(text), - contentColor: Color = MaterialTheme.colors.onBackground, + contentColor: Color = LocalColors.current.text, backgroundColor: Color = Color.Transparent, onClick: () -> Unit ) { @@ -260,7 +260,7 @@ fun BorderlessButtonWithIcon( @DrawableRes iconRes: Int, modifier: Modifier = Modifier, style: TextStyle = MaterialTheme.typography.baseBold, - contentColor: Color = MaterialTheme.colors.onBackground, + contentColor: Color = LocalColors.current.text, backgroundColor: Color = Color.Transparent, onClick: () -> Unit ) { @@ -278,7 +278,7 @@ fun BorderlessButtonWithIcon( fun BorderlessHtmlButton( textId: Int, modifier: Modifier = Modifier, - contentColor: Color = MaterialTheme.colors.onBackground, + contentColor: Color = LocalColors.current.text, backgroundColor: Color = Color.Transparent, onClick: () -> Unit ) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/SessionTabRow.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/SessionTabRow.kt index 729dd6bf16..28446951b5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/SessionTabRow.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/SessionTabRow.kt @@ -33,7 +33,7 @@ fun SessionTabRow(pagerState: PagerState, titles: List) { TabRow( backgroundColor = Color.Unspecified, selectedTabIndex = pagerState.currentPage, - contentColor = LocalColors.current.primary, + contentColor = LocalColors.current.text, divider = { TabRowDefaults.Divider(color = LocalColors.current.divider) }, modifier = Modifier .height(48.dp)