mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-05 12:47:43 +00:00
desktop: polish flat meta, deleted items and list
This commit is contained in:
1 parent
f5d4bc1cdc
commit
7e41fe4b1d
8 files changed
+26
-18
No files matched your search
+2
@@ -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,
|
||||
|
||||
+3
-3
@@ -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(
|
||||
|
||||
+1
-1
@@ -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(
|
||||
|
||||
+6
-4
@@ -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 {
|
||||
|
||||
+3
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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)) {
|
||||
|
||||
+9
-7
@@ -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
|
||||
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ private fun RowScope.RailContent(userPickerState: MutableStateFlow<AnimatedViewS
|
||||
RailTags()
|
||||
}
|
||||
}
|
||||
Divider(Modifier.padding(horizontal = DEFAULT_PADDING_HALF, vertical = DEFAULT_PADDING_HALF / 2))
|
||||
RailItem(MR.images.ic_settings, stringResource(MR.strings.settings_section_title_settings), active = false) {
|
||||
ModalManager.start.closeModals()
|
||||
ModalManager.start.showModalCloseable(cardScreen = true) { close ->
|
||||
|
||||
Reference in new issue
Block a user