diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt index b6767cfcfb..48451e003c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/NewConversationHomeFragment.kt @@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material.Divider import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.primarySurface @@ -20,6 +19,7 @@ import androidx.fragment.app.Fragment import dagger.hilt.android.AndroidEntryPoint import network.loki.messenger.R import org.session.libsession.utilities.TextSecurePreferences +import org.thoughtcrime.securesms.ui.Divider import org.thoughtcrime.securesms.ui.ItemButton import org.thoughtcrime.securesms.ui.LocalDimensions import org.thoughtcrime.securesms.ui.classicDarkColors 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 5ebe4ca14e..226fc6999e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -19,7 +19,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredWidth import androidx.compose.foundation.layout.width -import androidx.compose.material.Divider import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme import androidx.compose.material.Text @@ -94,6 +93,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.Divider import org.thoughtcrime.securesms.ui.LocalColors import org.thoughtcrime.securesms.ui.LocalDimensions import org.thoughtcrime.securesms.ui.PreviewTheme @@ -444,10 +444,8 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), ) } - Divider( - modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall), - color = LocalColors.current.borders - ) + Divider(modifier = Modifier.padding(vertical = LocalDimensions.current.marginExtraSmall)) + Text( stringResource(R.string.conversationsNone), style = MaterialTheme.typography.h8, diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotificationsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotificationsActivity.kt index 59ad8acf27..4d72afaf1c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotificationsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/messagenotifications/MessageNotificationsActivity.kt @@ -169,7 +169,7 @@ fun NotificationRadioButton( tag?.let { Text(stringResource(it), color = LocalColors.current.primary, style = MaterialTheme.typography.h9) } } } - RadioButton(selected = selected, modifier = Modifier.align(Alignment.CenterVertically), onClick = onClick) + RadioButton(selected = selected, modifier = Modifier.align(Alignment.CenterVertically), onClick = onClick, colors = LocalColors.current.radioButtonColors()) } } 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 47c5938d81..0b843ab03c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -321,10 +321,11 @@ fun Modifier.fadingEdges( ) @Composable -fun Divider() { +fun Divider(modifier: Modifier = Modifier, startIndent: Dp = 0.dp) { androidx.compose.material.Divider( - modifier = Modifier.padding(horizontal = 16.dp), - color = LocalColors.current.divider + modifier = modifier.padding(horizontal = LocalDimensions.current.marginExtraSmall), + color = LocalColors.current.divider, + startIndent = startIndent ) } 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 32e407dee3..b98cb2f3f7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Themes.kt @@ -37,7 +37,6 @@ import org.session.libsession.utilities.AppTextSecurePreferences import org.thoughtcrime.securesms.util.ThemeState import org.thoughtcrime.securesms.util.themeState -val LocalLightCell = staticCompositionLocalOf { Color.Black } val LocalOnLightCell = staticCompositionLocalOf { Color.Black } val LocalDimensions = staticCompositionLocalOf { Dimensions() } @@ -72,6 +71,8 @@ data class SessionColors( val backgroundBubbleReceived: Color = Color.Unspecified, val textBubbleReceived: Color = Color.Unspecified, ) { + val backgroundLight get() = if (isLight) backgroundSecondary else Color.White + val onBackgroundLight get() = if (isLight) text else background 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/QrImage.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QrImage.kt index 6446fe365b..415a4efe71 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/QrImage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QrImage.kt @@ -33,7 +33,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import network.loki.messenger.R import org.thoughtcrime.securesms.ui.LocalColors -import org.thoughtcrime.securesms.ui.LocalLightCell import org.thoughtcrime.securesms.ui.LocalOnLightCell import org.thoughtcrime.securesms.util.QRCodeUtilities @@ -47,23 +46,25 @@ fun QrImage( mutableStateOf(null) } + val dark = LocalColors.current.onBackgroundLight.value.toInt() + val scope = rememberCoroutineScope() LaunchedEffect(string) { scope.launch(Dispatchers.IO) { bitmap = (300..500 step 100).firstNotNullOf { - runCatching { QRCodeUtilities.encode(string, it) }.getOrNull() + runCatching { QRCodeUtilities.encode(string, it, dark = dark) }.getOrNull() } } } if (LocalColors.current.isLight) { - Content(bitmap, icon, modifier = modifier, backgroundColor = MaterialTheme.colors.surface) + Content(bitmap, icon, modifier = modifier, backgroundColor = LocalColors.current.backgroundSecondary) } else { Card( - backgroundColor = LocalLightCell.current, + backgroundColor = Color.White, elevation = 0.dp, modifier = modifier - ) { Content(bitmap, icon, modifier = Modifier.padding(16.dp), backgroundColor = LocalLightCell.current) } + ) { Content(bitmap, icon, modifier = Modifier.padding(16.dp), backgroundColor = Color.White) } } }