From 6609f49eb241a979f0afb102a8b5512b148e28b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de> Date: Tue, 21 Sep 2021 11:25:36 +0200 Subject: [PATCH] Improve signature of ContactCard --- .../desktop/paul/views/PrivateMessageView.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/org/briarproject/briar/desktop/paul/views/PrivateMessageView.kt b/src/main/kotlin/org/briarproject/briar/desktop/paul/views/PrivateMessageView.kt index 75b05dd5e3..6a33c78391 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/paul/views/PrivateMessageView.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/paul/views/PrivateMessageView.kt @@ -267,11 +267,15 @@ fun ProfileCircle(bitmap: ImageBitmap, size: Dp) { } @Composable -fun ContactCard(contact: Contact, selContact: Contact, onSel: (Contact) -> Unit, drawDetails: Boolean) { - var bgColor = briarBlack - if (selContact.id == contact.id && drawDetails) { - bgColor = darkGray - } +fun ContactCard( + contact: Contact, + selContact: Contact, + onSel: (Contact) -> Unit, + selected: Boolean, + drawNotifications: Boolean +) { + // selContact.id == contact.id && drawNotifications + val bgColor = if (selected) darkGray else briarBlack Row( modifier = Modifier.fillMaxWidth().height(HEADER_SIZE).background(bgColor) .clickable(onClick = { onSel(contact) }), @@ -281,7 +285,7 @@ fun ContactCard(contact: Contact, selContact: Contact, onSel: (Contact) -> Unit, // TODO Pull profile pictures ProfileCircle(imageFromResource("images/profile_images/p0.png"), 36.dp) // Draw notification badges - if (drawDetails) { + if (drawNotifications) { androidx.compose.foundation.Canvas( modifier = Modifier.align(Alignment.CenterVertically), onDraw = { @@ -378,7 +382,7 @@ fun ContactList( content = { Column(Modifier.verticalScroll(rememberScrollState())) { for (c in filteredContacts) { - ContactCard(c, currContact, onContactSelect, true) + ContactCard(c, currContact, onContactSelect, currContact.id == c.id, true) } } }, @@ -672,7 +676,7 @@ fun ContactDrawerMakeIntro(currContact: Contact, contacts: List<Contact>, setInf Column(Modifier.verticalScroll(rememberScrollState())) { for (c in contacts) { if (c.id != currContact.id) { - ContactCard(c, currContact, { onCancelSel(c); introNextPg = true }, false) + ContactCard(c, currContact, { onCancelSel(c); introNextPg = true }, false, false) } } } -- GitLab