Skip to content
Snippets Groups Projects
Commit 6609f49e authored by Sebastian's avatar Sebastian Committed by Sebastian
Browse files

Improve signature of ContactCard

parent 9a69b249
No related branches found
No related tags found
1 merge request!7Import upstream updates to UI
...@@ -267,11 +267,15 @@ fun ProfileCircle(bitmap: ImageBitmap, size: Dp) { ...@@ -267,11 +267,15 @@ fun ProfileCircle(bitmap: ImageBitmap, size: Dp) {
} }
@Composable @Composable
fun ContactCard(contact: Contact, selContact: Contact, onSel: (Contact) -> Unit, drawDetails: Boolean) { fun ContactCard(
var bgColor = briarBlack contact: Contact,
if (selContact.id == contact.id && drawDetails) { selContact: Contact,
bgColor = darkGray onSel: (Contact) -> Unit,
} selected: Boolean,
drawNotifications: Boolean
) {
// selContact.id == contact.id && drawNotifications
val bgColor = if (selected) darkGray else briarBlack
Row( Row(
modifier = Modifier.fillMaxWidth().height(HEADER_SIZE).background(bgColor) modifier = Modifier.fillMaxWidth().height(HEADER_SIZE).background(bgColor)
.clickable(onClick = { onSel(contact) }), .clickable(onClick = { onSel(contact) }),
...@@ -281,7 +285,7 @@ fun ContactCard(contact: Contact, selContact: Contact, onSel: (Contact) -> Unit, ...@@ -281,7 +285,7 @@ fun ContactCard(contact: Contact, selContact: Contact, onSel: (Contact) -> Unit,
// TODO Pull profile pictures // TODO Pull profile pictures
ProfileCircle(imageFromResource("images/profile_images/p0.png"), 36.dp) ProfileCircle(imageFromResource("images/profile_images/p0.png"), 36.dp)
// Draw notification badges // Draw notification badges
if (drawDetails) { if (drawNotifications) {
androidx.compose.foundation.Canvas( androidx.compose.foundation.Canvas(
modifier = Modifier.align(Alignment.CenterVertically), modifier = Modifier.align(Alignment.CenterVertically),
onDraw = { onDraw = {
...@@ -378,7 +382,7 @@ fun ContactList( ...@@ -378,7 +382,7 @@ fun ContactList(
content = { content = {
Column(Modifier.verticalScroll(rememberScrollState())) { Column(Modifier.verticalScroll(rememberScrollState())) {
for (c in filteredContacts) { 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 ...@@ -672,7 +676,7 @@ fun ContactDrawerMakeIntro(currContact: Contact, contacts: List<Contact>, setInf
Column(Modifier.verticalScroll(rememberScrollState())) { Column(Modifier.verticalScroll(rememberScrollState())) {
for (c in contacts) { for (c in contacts) {
if (c.id != currContact.id) { if (c.id != currContact.id) {
ContactCard(c, currContact, { onCancelSel(c); introNextPg = true }, false) ContactCard(c, currContact, { onCancelSel(c); introNextPg = true }, false, false)
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment