diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/CIMetaView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/CIMetaView.kt index e318f406de..9d1a9af478 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/CIMetaView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/CIMetaView.kt @@ -12,6 +12,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import chat.simplex.common.LocalFlatLayout import chat.simplex.common.model.* import chat.simplex.common.platform.appPreferences import chat.simplex.common.ui.theme.isInDarkTheme @@ -41,6 +42,7 @@ fun CIMetaView( ) { Row(Modifier.padding(start = 3.dp), verticalAlignment = Alignment.CenterVertically) { if (chatItem.isDeletedContent) { + if (!showTimestamp && LocalFlatLayout.current) return@Row Text( chatItem.timestampText, color = metaColor, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt index 8691634e1c..aa7e26a576 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/ChatItemView.kt @@ -144,7 +144,7 @@ fun ChatItemView( Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = if (flat) Arrangement.spacedBy(4.dp) else Arrangement.Start, - modifier = if (flat) Modifier.padding(start = FLAT_TEXT_START_PADDING, top = FLAT_TEXT_VERTICAL_PADDING) else Modifier.chatItemOffset(cItem, itemSeparation.largeGap, inverted = true, revealed = true) + modifier = if (flat) Modifier.padding(start = FLAT_TEXT_START_PADDING, top = FLAT_TEXT_VERTICAL_PADDING, bottom = FLAT_TEXT_VERTICAL_PADDING * 2) else Modifier.chatItemOffset(cItem, itemSeparation.largeGap, inverted = true, revealed = true) ) { cItem.reactions.forEach { r -> val showReactionMenu = remember { mutableStateOf(false) } @@ -212,8 +212,8 @@ fun ChatItemView( ) .onRightClick { showReactionsMenu() } } - Row(modifier.padding(if (flat) PaddingValues(horizontal = FLAT_PILL_HORIZONTAL_PADDING, vertical = 2.dp) else PaddingValues(2.dp)), verticalAlignment = Alignment.CenterVertically) { - ReactionIcon(r.reaction.text, fontSize = 12.sp) + Row(modifier.padding(if (flat) PaddingValues(horizontal = FLAT_PILL_HORIZONTAL_PADDING, vertical = 3.dp) else PaddingValues(2.dp)), verticalAlignment = Alignment.CenterVertically) { + ReactionIcon(r.reaction.text, fontSize = if (flat) 14.sp else 12.sp) DefaultDropdownMenu(showMenu = showReactionMenu) { reactionMenuItems.value.forEach { m -> ItemAction( diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/DeletedItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/DeletedItemView.kt index 7fb165f0b4..f3c5cc63de 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/DeletedItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/DeletedItemView.kt @@ -28,7 +28,7 @@ fun DeletedItemView(ci: ChatItem, timedMessagesTTL: Int?, showViaProxy: Boolean, contentColor = LocalContentColor.current ) { Row( - Modifier.padding(horizontal = 12.dp, vertical = 6.dp), + Modifier.padding(horizontal = 12.dp, vertical = if (LocalFlatLayout.current) FLAT_TEXT_VERTICAL_PADDING else 6.dp), verticalAlignment = Alignment.Bottom ) { Text( diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FlatChatItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FlatChatItemView.kt index da2d000539..3068c3ce95 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FlatChatItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FlatChatItemView.kt @@ -155,9 +155,10 @@ fun FlatChatItemRow( Text( cItem.timestampText, Modifier.align(Alignment.TopEnd).padding(top = FLAT_TEXT_VERTICAL_PADDING + 3.dp, end = FLAT_GUTTER_TIME_END_PADDING), - fontSize = 11.sp, + fontSize = 10.sp, color = MaterialTheme.colors.secondary, - maxLines = 1 + maxLines = 1, + softWrap = false ) } } @@ -312,7 +313,7 @@ fun FlatHoverBar( Modifier.size(FLAT_BAR_BUTTON_SIZE).clip(CircleShape).clickable { setReaction(cInfo, cItem, true, r) }, contentAlignment = Alignment.Center ) { - ReactionIcon(r.text, 12.sp) + ReactionIcon(r.text, 14.sp) } } Box { @@ -340,12 +341,13 @@ private fun FlatBarButton(icon: ImageResource, description: String, onClick: () } } +// with nothing to show, the reserved meta is the timestamp alone; any icon adds space before it @Composable fun flatMetaVisible(ci: ChatItem, chatTTL: Int?, showViaProxy: Boolean): Boolean = reserveSpaceForMeta( ci.meta, chatTTL, ci.encryptedFile, MaterialTheme.colors.secondary, showStatus = ci.chatDir.sent, showViaProxy = showViaProxy, showTimestamp = true, signedFileVerified = ci.file?.loaded - ).isNotEmpty() + ) != ci.meta.timestampText @Composable fun Modifier.flatQuoteBar(): Modifier { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt index c8a74fd4ac..b366efa273 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/FramedItemView.kt @@ -16,6 +16,7 @@ import dev.icerock.moko.resources.compose.painterResource import dev.icerock.moko.resources.compose.stringResource import androidx.compose.ui.text.* import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.* import chat.simplex.common.LocalFlatLayout @@ -92,7 +93,7 @@ fun FramedItemView( ) { Text( sender, - style = TextStyle(fontSize = 13.5.sp, color = if (qi.chatDir is CIDirection.GroupSnd) CurrentColors.value.colors.primary else CurrentColors.value.colors.secondary), + style = TextStyle(fontSize = 13.5.sp, fontWeight = if (flat) FontWeight.SemiBold else null, color = if (qi.chatDir is CIDirection.GroupSnd) CurrentColors.value.colors.primary else CurrentColors.value.colors.secondary), maxLines = 1 ) ciQuotedMsgTextView(qi, lines = 2, showTimestamp = showTimestamp, stripLink = stripLink, prefix = prefix) @@ -126,7 +127,7 @@ fun FramedItemView( .background(if (flat) Color.Transparent else if (sent) sentColor else receivedColor) .fillMaxWidth() .then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier) - .padding(start = if (flat) FLAT_TEXT_START_PADDING else 8.dp, top = 6.dp, end = 12.dp, bottom = if (pad || (ci.quotedItem == null && ci.meta.itemForwarded == null)) 6.dp else 0.dp) + .padding(start = if (flat) FLAT_TEXT_START_PADDING else 8.dp, top = if (flat) FLAT_TEXT_VERTICAL_PADDING else 6.dp, end = 12.dp, bottom = if (pad || (ci.quotedItem == null && ci.meta.itemForwarded == null)) 6.dp else 0.dp) } @Composable diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/MarkedDeletedItemView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/MarkedDeletedItemView.kt index 3b4f198a4b..1a4146404f 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/MarkedDeletedItemView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/item/MarkedDeletedItemView.kt @@ -31,7 +31,7 @@ fun MarkedDeletedItemView(chatsCtx: ChatModel.ChatsContext, ci: ChatItem, chatIn contentColor = LocalContentColor.current ) { Row( - Modifier.padding(horizontal = 12.dp, vertical = 6.dp), + Modifier.padding(horizontal = 12.dp, vertical = if (LocalFlatLayout.current) FLAT_TEXT_VERTICAL_PADDING else 6.dp), verticalAlignment = Alignment.CenterVertically ) { Box(Modifier.weight(1f, false)) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt index 15828c7978..37c9c52188 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatPreviewView.kt @@ -52,6 +52,9 @@ fun ChatPreviewView( defaultClickAction: () -> Unit ) { val cInfo = chat.chatInfo + val flat = LocalFlatLayout.current + val titleStyle = if (flat) MaterialTheme.typography.body1 else MaterialTheme.typography.h3 + val titleWeight = if (!flat) FontWeight.Bold else if (chat.chatStats.unreadCount > 0 || chat.chatStats.unreadChat) FontWeight.SemiBold else FontWeight.Normal @Composable fun inactiveIcon() { @@ -84,13 +87,12 @@ fun ChatPreviewView( @Composable fun chatPreviewTitleText(color: Color = Color.Unspecified) { - val flat = LocalFlatLayout.current Text( cInfo.chatViewName, maxLines = 1, overflow = TextOverflow.Ellipsis, - style = if (flat) MaterialTheme.typography.body1 else MaterialTheme.typography.h3, - fontWeight = if (!flat) FontWeight.Bold else if (chat.chatStats.unreadCount > 0 || chat.chatStats.unreadChat) FontWeight.SemiBold else FontWeight.Normal, + style = titleStyle, + fontWeight = titleWeight, color = color ) } @@ -159,8 +161,8 @@ fun ChatPreviewView( cInfo.nameBadge, maxLines = 1, overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.h3, - fontWeight = FontWeight.Bold, + style = titleStyle, + fontWeight = titleWeight, color = color ) } @@ -466,7 +468,7 @@ fun ChatPreviewView( } } - if (LocalFlatLayout.current) { + if (flat) { LaunchedEffect(chatModel.deletedChats.value) { val ci = chat.chatItems.lastOrNull() val playing = AudioPlayer.currentlyPlaying.value @@ -567,7 +569,7 @@ fun ChatPreviewView( } } -internal val COMPACT_CHAT_IMAGE_SIZE = 32.dp +internal val COMPACT_CHAT_IMAGE_SIZE = 28.dp // cancels the 3dp yOffset that UnreadBadge applies for the two-line row private val COMPACT_BADGE_Y_CORRECTION = 3.dp diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/DesktopRail.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/DesktopRail.kt index 9a63535fbb..43599d6e80 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/DesktopRail.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/DesktopRail.kt @@ -70,6 +70,7 @@ private fun RowScope.RailContent(userPickerState: MutableStateFlow