From eb98ce961cc9dc90f75098ce03d798e40e3f7c86 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 14 Mar 2024 14:28:56 +1030 Subject: [PATCH] Add text selection colors --- .../main/java/org/thoughtcrime/securesms/ui/Colors.kt | 3 +-- .../main/java/org/thoughtcrime/securesms/ui/Themes.kt | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt index 13df8426c2..94a72c7f48 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Colors.kt @@ -80,7 +80,7 @@ fun destructiveButtonColors() = ButtonDefaults.buttonColors(backgroundColor = Co @Preview @Composable -fun Context.PreviewMessageDetails( +fun PreviewMessageDetails( @PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int ) { PreviewTheme(themeResId) { @@ -127,6 +127,5 @@ fun outlinedTextFieldColors( textColor = if (isError) colorDestructive else LocalContentColor.current.copy(LocalContentAlpha.current), focusedBorderColor = Color(classicDark3), unfocusedBorderColor = Color(classicDark3), - cursorColor = LocalContentColor.current, placeholderColor = if (isError) colorDestructive else MaterialTheme.colors.onSurface.copy(ContentAlpha.medium) ) 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 469b11eeec..9e681868b4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt @@ -5,6 +5,8 @@ import androidx.annotation.AttrRes import androidx.appcompat.view.ContextThemeWrapper import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.text.selection.LocalTextSelectionColors +import androidx.compose.foundation.text.selection.TextSelectionColors import androidx.compose.material.LocalContentColor import androidx.compose.material.MaterialTheme import androidx.compose.material.Shapes @@ -55,9 +57,15 @@ fun AppTheme( val surface = context.getColorFromTheme(R.attr.colorSettingsBackground) + CompositionLocalProvider(LocalExtraColors provides extraColors) { AppCompatTheme(surface = surface) { - content() + CompositionLocalProvider(LocalTextSelectionColors provides TextSelectionColors( + handleColor = MaterialTheme.colors.secondary, + backgroundColor = MaterialTheme.colors.secondary.copy(alpha = 0.5f) + )) { + content() + } } } }