diff --git a/apps/android/app/src/main/java/chat/simplex/app/MainActivity.kt b/apps/android/app/src/main/java/chat/simplex/app/MainActivity.kt index 029fa52b6..5eec89ee5 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/MainActivity.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/MainActivity.kt @@ -83,14 +83,16 @@ class MainActivity: FragmentActivity() { } setContent { SimpleXTheme { - MainPage( - m, - userAuthorized, - laFailed, - ::runAuthenticate, - ::setPerformLA, - showLANotice = { showLANotice(m.controller.appPrefs.laNoticeShown, this) } - ) + Surface(color = MaterialTheme.colors.background) { + MainPage( + m, + userAuthorized, + laFailed, + ::runAuthenticate, + ::setPerformLA, + showLANotice = { showLANotice(m.controller.appPrefs.laNoticeShown, this) } + ) + } } } SimplexApp.context.schedulePeriodicServiceRestartWorker() diff --git a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Color.kt b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Color.kt index ee2997b42..84686d748 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Color.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Color.kt @@ -21,7 +21,6 @@ val ToolbarDark = Color(80, 80, 80, 12) val SettingsSecondaryLight = Color(200, 196, 195, 90) val GroupDark = Color(80, 80, 80, 60) val IncomingCallLight = Color(239, 237, 236, 255) -val IncomingCallDark = Color(34, 30, 29, 255) val WarningOrange = Color(255, 127, 0, 255) val WarningYellow = Color(255, 192, 0, 255) val FileLight = Color(183, 190, 199, 255) diff --git a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Theme.kt b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Theme.kt index 118bca224..24652c76f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Theme.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/Theme.kt @@ -16,6 +16,7 @@ import chat.simplex.app.views.helpers.* import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import okhttp3.internal.toHexString enum class DefaultTheme { SYSTEM, LIGHT, DARK, SIMPLEX; @@ -128,11 +129,29 @@ data class ThemeColors( receivedMessage = receivedMessage?.colorFromReadableHex() ?: baseColors.receivedMessage, ) } + + fun withFilledColors(base: DefaultTheme): ThemeColors { + val c = toColors(base) + val ac = toAppColors(base) + return ThemeColors( + primary = c.primary.toReadableHex(), + primaryVariant = c.primaryVariant.toReadableHex(), + secondary = c.secondary.toReadableHex(), + secondaryVariant = c.secondaryVariant.toReadableHex(), + background = c.background.toReadableHex(), + surface = c.surface.toReadableHex(), + title = ac.title.toReadableHex(), + sentMessage = ac.sentMessage.toReadableHex(), + receivedMessage = ac.receivedMessage.toReadableHex() + ) + } } private fun String.colorFromReadableHex(): Color = Color(this.replace("#", "").toLongOrNull(16) ?: Color.White.toArgb().toLong()) +private fun Color.toReadableHex(): String = "#" + toArgb().toHexString() + @Serializable data class ThemeOverrides ( val base: DefaultTheme, @@ -153,9 +172,6 @@ data class ThemeOverrides ( } } -@Serializable -data class ThemeData (val colors: ThemeColors) - fun Modifier.themedBackground(baseTheme: DefaultTheme = CurrentColors.value.base, shape: Shape = RectangleShape): Modifier { return if (baseTheme == DefaultTheme.SIMPLEX) { this.background(brush = Brush.linearGradient( diff --git a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/ThemeManager.kt b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/ThemeManager.kt index ef9c42fe7..3453dad7e 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/ui/theme/ThemeManager.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/ui/theme/ThemeManager.kt @@ -44,19 +44,16 @@ object ThemeManager { return ActiveTheme(themeName, baseTheme.first, theme.colors.toColors(theme.base), theme.colors.toAppColors(theme.base)) } - fun currentThemeData(darkForSystemTheme: Boolean): ThemeData { - val t = currentColors(darkForSystemTheme) - return ThemeData(colors = ThemeColors( - primary = t.colors.primary.toReadableHex(), - primaryVariant = t.colors.primaryVariant.toReadableHex(), - secondary = t.colors.secondary.toReadableHex(), - secondaryVariant = t.colors.secondaryVariant.toReadableHex(), - background = t.colors.background.toReadableHex(), - surface = t.colors.surface.toReadableHex(), - title = t.appColors.title.toReadableHex(), - sentMessage = t.appColors.sentMessage.toReadableHex(), - receivedMessage = t.appColors.receivedMessage.toReadableHex() - )) + fun currentThemeOverridesForExport(darkForSystemTheme: Boolean): ThemeOverrides { + val themeName = appPrefs.currentTheme.get()!! + val nonSystemThemeName = if (themeName != DefaultTheme.SYSTEM.name) { + themeName + } else { + if (darkForSystemTheme) appPrefs.systemDarkTheme.get()!! else DefaultTheme.LIGHT.name + } + val overrides = appPrefs.themeOverrides.get().toMutableMap() + val nonFilledTheme = overrides[nonSystemThemeName] ?: ThemeOverrides(base = CurrentColors.value.base, colors = ThemeColors()) + return nonFilledTheme.copy(colors = nonFilledTheme.colors.withFilledColors(CurrentColors.value.base)) } // colors, default theme enum, localized name of theme @@ -128,11 +125,12 @@ object ThemeManager { CurrentColors.value = currentColors(!CurrentColors.value.colors.isLight) } - fun saveAndApplyThemeData(name: String, theme: ThemeData, darkForSystemTheme: Boolean) { + fun saveAndApplyThemeOverrides(theme: ThemeOverrides, darkForSystemTheme: Boolean) { val overrides = appPrefs.themeOverrides.get().toMutableMap() - val prevValue = overrides[name] ?: ThemeOverrides(base = CurrentColors.value.base, colors = ThemeColors()) - overrides[name] = prevValue.copy(colors = theme.colors) + val prevValue = overrides[theme.base.name] ?: ThemeOverrides(base = CurrentColors.value.base, colors = ThemeColors()) + overrides[theme.base.name] = prevValue.copy(colors = theme.colors) appPrefs.themeOverrides.set(overrides) + appPrefs.currentTheme.set(theme.base.name) CurrentColors.value = currentColors(!CurrentColors.value.colors.isLight) } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/TerminalView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/TerminalView.kt index b342cc731..15688db8b 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/TerminalView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/TerminalView.kt @@ -99,8 +99,8 @@ fun TerminalLayout( Surface( modifier = Modifier .padding(contentPadding) - .fillMaxWidth() - .themedBackground() + .fillMaxWidth(), + color = MaterialTheme.colors.background ) { TerminalLog(terminalItems) } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/WelcomeView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/WelcomeView.kt index 0eea155fb..1dc1dca0a 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/WelcomeView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/WelcomeView.kt @@ -44,77 +44,75 @@ fun CreateProfilePanel(chatModel: ChatModel, close: () -> Unit) { val fullName = rememberSaveable { mutableStateOf("") } val focusRequester = remember { FocusRequester() } - Surface(Modifier.background(MaterialTheme.colors.onBackground)) { - Column( - modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()) - ) { - /*CloseSheetBar(close = { - if (chatModel.users.isEmpty()) { - chatModel.onboardingStage.value = OnboardingStage.Step1_SimpleXInfo - } else { - close() - } - })*/ - Column(Modifier.padding(horizontal = DEFAULT_PADDING * 1f)) { - AppBarTitle(stringResource(R.string.create_profile)) - ReadableText(R.string.your_profile_is_stored_on_your_device, TextAlign.Center, padding = PaddingValues()) - ReadableText(R.string.profile_is_only_shared_with_your_contacts, TextAlign.Center) - Spacer(Modifier.height(DEFAULT_PADDING * 1.5f)) - Row(Modifier.padding(bottom = DEFAULT_PADDING_HALF).fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { - Text( - stringResource(R.string.display_name), - fontSize = 16.sp - ) - if (!isValidDisplayName(displayName.value)) { - Text( - stringResource(R.string.no_spaces), - fontSize = 16.sp, - color = Color.Red - ) - } - } - ProfileNameField(displayName, "", ::isValidDisplayName, focusRequester) - Spacer(Modifier.height(DEFAULT_PADDING)) + Column( + modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()) + ) { + /*CloseSheetBar(close = { + if (chatModel.users.isEmpty()) { + chatModel.onboardingStage.value = OnboardingStage.Step1_SimpleXInfo + } else { + close() + } + })*/ + Column(Modifier.padding(horizontal = DEFAULT_PADDING * 1f)) { + AppBarTitle(stringResource(R.string.create_profile)) + ReadableText(R.string.your_profile_is_stored_on_your_device, TextAlign.Center, padding = PaddingValues()) + ReadableText(R.string.profile_is_only_shared_with_your_contacts, TextAlign.Center) + Spacer(Modifier.height(DEFAULT_PADDING * 1.5f)) + Row(Modifier.padding(bottom = DEFAULT_PADDING_HALF).fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { Text( - stringResource(R.string.full_name_optional__prompt), - fontSize = 16.sp, - modifier = Modifier.padding(bottom = DEFAULT_PADDING_HALF) + stringResource(R.string.display_name), + fontSize = 16.sp ) - ProfileNameField(fullName, "", ::isValidDisplayName) - } - Spacer(Modifier.fillMaxHeight().weight(1f)) - Row { - if (chatModel.users.isEmpty()) { - SimpleButtonDecorated( - text = stringResource(R.string.about_simplex), - icon = painterResource(R.drawable.ic_arrow_back_ios_new), - textDecoration = TextDecoration.None, - fontWeight = FontWeight.Medium - ) { chatModel.onboardingStage.value = OnboardingStage.Step1_SimpleXInfo } - } - Spacer(Modifier.fillMaxWidth().weight(1f)) - val enabled = displayName.value.isNotEmpty() && isValidDisplayName(displayName.value) - val createModifier: Modifier - val createColor: Color - if (enabled) { - createModifier = Modifier.clickable { createProfile(chatModel, displayName.value, fullName.value, close) }.padding(8.dp) - createColor = MaterialTheme.colors.primary - } else { - createModifier = Modifier.padding(8.dp) - createColor = MaterialTheme.colors.secondary - } - Surface(shape = RoundedCornerShape(20.dp)) { - Row(verticalAlignment = Alignment.CenterVertically, modifier = createModifier) { - Text(stringResource(R.string.create_profile_button), style = MaterialTheme.typography.caption, color = createColor, fontWeight = FontWeight.Medium) - Icon(painterResource(R.drawable.ic_arrow_forward_ios), stringResource(R.string.create_profile_button), tint = createColor) - } + if (!isValidDisplayName(displayName.value)) { + Text( + stringResource(R.string.no_spaces), + fontSize = 16.sp, + color = Color.Red + ) } } + ProfileNameField(displayName, "", ::isValidDisplayName, focusRequester) + Spacer(Modifier.height(DEFAULT_PADDING)) + Text( + stringResource(R.string.full_name_optional__prompt), + fontSize = 16.sp, + modifier = Modifier.padding(bottom = DEFAULT_PADDING_HALF) + ) + ProfileNameField(fullName, "", ::isValidDisplayName) + } + Spacer(Modifier.fillMaxHeight().weight(1f)) + Row { + if (chatModel.users.isEmpty()) { + SimpleButtonDecorated( + text = stringResource(R.string.about_simplex), + icon = painterResource(R.drawable.ic_arrow_back_ios_new), + textDecoration = TextDecoration.None, + fontWeight = FontWeight.Medium + ) { chatModel.onboardingStage.value = OnboardingStage.Step1_SimpleXInfo } + } + Spacer(Modifier.fillMaxWidth().weight(1f)) + val enabled = displayName.value.isNotEmpty() && isValidDisplayName(displayName.value) + val createModifier: Modifier + val createColor: Color + if (enabled) { + createModifier = Modifier.clickable { createProfile(chatModel, displayName.value, fullName.value, close) }.padding(8.dp) + createColor = MaterialTheme.colors.primary + } else { + createModifier = Modifier.padding(8.dp) + createColor = MaterialTheme.colors.secondary + } + Surface(shape = RoundedCornerShape(20.dp), color = Color.Transparent) { + Row(verticalAlignment = Alignment.CenterVertically, modifier = createModifier) { + Text(stringResource(R.string.create_profile_button), style = MaterialTheme.typography.caption, color = createColor, fontWeight = FontWeight.Medium) + Icon(painterResource(R.drawable.ic_arrow_forward_ios), stringResource(R.string.create_profile_button), tint = createColor) + } + } + } - LaunchedEffect(Unit) { - delay(300) - focusRequester.requestFocus() - } + LaunchedEffect(Unit) { + delay(300) + focusRequester.requestFocus() } } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallActivity.kt b/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallActivity.kt index 1f8b0775c..d5282f3c3 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallActivity.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallActivity.kt @@ -97,8 +97,9 @@ fun IncomingCallActivityView(m: ChatModel) { SimpleXTheme { Surface( Modifier - .themedBackground() - .fillMaxSize()) { + .fillMaxSize(), + color = MaterialTheme.colors.background + ) { if (showCallView) { Box { ActiveCallView(m) @@ -226,8 +227,9 @@ fun PreviewIncomingCallLockScreenAlert() { SimpleXTheme(true) { Surface( Modifier - .themedBackground() - .fillMaxSize()) { + .fillMaxSize(), + color = MaterialTheme.colors.background + ) { IncomingCallLockScreenAlertLayout( invitation = RcvCallInvitation( user = User.sampleData, diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallAlertView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallAlertView.kt index c062f6f81..6afe1b349 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallAlertView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/call/IncomingCallAlertView.kt @@ -50,13 +50,13 @@ fun IncomingCallAlertLayout( ignoreCall: () -> Unit, acceptCall: () -> Unit ) { - val color = if (isInDarkTheme()) IncomingCallDark else IncomingCallLight + val color = if (isInDarkTheme()) MaterialTheme.colors.surface else IncomingCallLight Column(Modifier.fillMaxWidth().background(color).padding(top = DEFAULT_PADDING, bottom = DEFAULT_PADDING, start = DEFAULT_PADDING, end = 8.dp)) { IncomingCallInfo(invitation, chatModel) Spacer(Modifier.height(8.dp)) Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween) { Row(Modifier.fillMaxWidth().weight(1f), verticalAlignment = Alignment.CenterVertically) { - ProfilePreview(profileOf = invitation.contact, size = 64.dp, color = Color.White) + ProfilePreview(profileOf = invitation.contact, size = 64.dp) } Row(verticalAlignment = Alignment.CenterVertically) { CallButton(stringResource(R.string.reject), painterResource(R.drawable.ic_call_end_filled), Color.Red, rejectCall) @@ -78,7 +78,7 @@ fun IncomingCallInfo(invitation: RcvCallInvitation, chatModel: ChatModel) { if (invitation.callType.media == CallMediaType.Video) CallIcon(painterResource(R.drawable.ic_videocam_filled), stringResource(R.string.icon_descr_video_call)) else CallIcon(painterResource(R.drawable.ic_call_filled), stringResource(R.string.icon_descr_audio_call)) Spacer(Modifier.width(4.dp)) - Text(invitation.callTypeText) + Text(invitation.callTypeText, color = MaterialTheme.colors.onBackground) } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt index 9b2da5a42..d2bc6bc0f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt @@ -326,7 +326,6 @@ fun ChatLayout( Box( Modifier .fillMaxWidth() - .themedBackground() ) { ProvideWindowInsets(windowInsetsAnimationsEnabled = true) { ModalBottomSheetLayout( diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ShareListView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ShareListView.kt index 0be8f9b53..1f7492906 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ShareListView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ShareListView.kt @@ -35,7 +35,6 @@ fun ShareListView(chatModel: ChatModel, stopped: Boolean) { Column( modifier = Modifier .fillMaxSize() - .themedBackground() ) { if (chatModel.chats.isNotEmpty()) { ShareList(chatModel, search = searchInList) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt index 8b20bafc2..39f7d8893 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt @@ -37,7 +37,6 @@ import androidx.core.text.HtmlCompat import chat.simplex.app.* import chat.simplex.app.R import chat.simplex.app.model.* -import chat.simplex.app.ui.theme.ThemeData import chat.simplex.app.ui.theme.ThemeOverrides import com.charleskorn.kaml.decodeFromStream import kotlinx.coroutines.* @@ -391,10 +390,10 @@ fun getDrawableFromUri(uri: Uri, withAlertOnException: Boolean = true): Drawable } } -fun getThemeFromUri(uri: Uri, withAlertOnException: Boolean = true): ThemeData? { +fun getThemeFromUri(uri: Uri, withAlertOnException: Boolean = true): ThemeOverrides? { SimplexApp.context.contentResolver.openInputStream(uri).use { runCatching { - return yaml.decodeFromStream(it!!) + return yaml.decodeFromStream(it!!) }.onFailure { if (withAlertOnException) { AlertManager.shared.showAlertMsg( diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/newchat/AddGroupView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/newchat/AddGroupView.kt index a570ca341..b166d07bf 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/newchat/AddGroupView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/newchat/AddGroupView.kt @@ -159,7 +159,7 @@ fun CreateGroupButton(color: Color, modifier: Modifier) { Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End ) { - Surface(shape = RoundedCornerShape(20.dp)) { + Surface(shape = RoundedCornerShape(20.dp), color = Color.Transparent) { Row(modifier, verticalAlignment = Alignment.CenterVertically) { Text(stringResource(R.string.create_profile_button), style = MaterialTheme.typography.caption, color = color, fontWeight = FontWeight.Bold) Icon(painterResource(R.drawable.ic_arrow_forward_ios), stringResource(R.string.create_profile_button), tint = color) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/newchat/NewChatSheet.kt b/apps/android/app/src/main/java/chat/simplex/app/views/newchat/NewChatSheet.kt index 5224a3ab4..0808229e6 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/newchat/NewChatSheet.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/newchat/NewChatSheet.kt @@ -173,7 +173,7 @@ fun ActionButton( disabled: Boolean = false, click: () -> Unit = {} ) { - Surface(shape = RoundedCornerShape(18.dp)) { + Surface(shape = RoundedCornerShape(18.dp), color = Color.Transparent) { Column( Modifier .clickable(onClick = click) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/onboarding/OnboardingView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/onboarding/OnboardingView.kt index ada3de9da..bd8e30186 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/onboarding/OnboardingView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/onboarding/OnboardingView.kt @@ -31,7 +31,6 @@ fun CreateProfile(chatModel: ChatModel, close: () -> Unit) { Box( modifier = Modifier .fillMaxSize() - .background(color = MaterialTheme.colors.background) .padding(20.dp) ) { CreateProfilePanel(chatModel, close) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt index 538a470bf..961765c13 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt @@ -240,8 +240,8 @@ fun CustomizeThemeView(editColor: (ThemeColor, Color) -> Unit) { val theme = remember { mutableStateOf(null as String?) } val exportThemeLauncher = rememberSaveThemeLauncher(context, theme) SectionItemView({ - val themeData = ThemeManager.currentThemeData(isInDarkTheme) - theme.value = yaml.encodeToString(themeData) + val overrides = ThemeManager.currentThemeOverridesForExport(isInDarkTheme) + theme.value = yaml.encodeToString(overrides) exportThemeLauncher.launch("simplex.theme") }) { Text(generalGetString(R.string.export_theme), color = colors.primary) @@ -251,7 +251,7 @@ fun CustomizeThemeView(editColor: (ThemeColor, Color) -> Unit) { if (uri != null) { val theme = getThemeFromUri(uri) if (theme != null) { - ThemeManager.saveAndApplyThemeData(currentTheme.name, theme, isInDarkTheme) + ThemeManager.saveAndApplyThemeOverrides(theme, isInDarkTheme) } } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt index 2c9060007..1b1b27292 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt @@ -8,7 +8,6 @@ import SectionView import TextIconSpaced import android.content.Context import android.content.res.Configuration -import androidx.activity.compose.BackHandler import androidx.compose.foundation.* import androidx.compose.foundation.layout.* import androidx.compose.material.* @@ -362,15 +361,15 @@ fun ChatLockItem( Text("v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})") } -@Composable fun ProfilePreview(profileOf: NamedChat, size: Dp = 60.dp, color: Color = MaterialTheme.colors.secondaryVariant, stopped: Boolean = false) { - ProfileImage(size = size, image = profileOf.image, color = color) +@Composable fun ProfilePreview(profileOf: NamedChat, size: Dp = 60.dp, iconColor: Color = MaterialTheme.colors.secondaryVariant, textColor: Color = MaterialTheme.colors.onBackground, stopped: Boolean = false) { + ProfileImage(size = size, image = profileOf.image, color = iconColor) Spacer(Modifier.padding(horizontal = 8.dp)) Column(Modifier.height(size), verticalArrangement = Arrangement.Center) { Text( profileOf.displayName, style = MaterialTheme.typography.caption, fontWeight = FontWeight.Bold, - color = if (stopped) MaterialTheme.colors.secondary else Color.Unspecified, + color = if (stopped) MaterialTheme.colors.secondary else textColor, maxLines = 1, overflow = TextOverflow.Ellipsis ) @@ -378,7 +377,7 @@ fun ChatLockItem( Text( profileOf.fullName, Modifier.padding(vertical = 5.dp), - color = if (stopped) MaterialTheme.colors.secondary else Color.Unspecified, + color = if (stopped) MaterialTheme.colors.secondary else textColor, maxLines = 1, overflow = TextOverflow.Ellipsis )