1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-25 09:34:25 +00:00

Wrap RoomListItem in a Box to have the DropdownMenu display correctly

This commit is contained in:
Steffo 2024-01-21 15:42:19 +01:00
parent 395709cc28
commit 6abfb78ad6
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -71,48 +71,52 @@ fun RoomListItem(
Log.d("Main", "Successfully left room `$roomId`!") Log.d("Main", "Successfully left room `$roomId`!")
} }
ListItem( Box {
modifier = Modifier.combinedClickable(
onClick = { openRoom() },
onLongClick = { expanded = true }
),
headlineContent = {
Text(roomSummary.displayName)
},
leadingContent = {
Box(
modifier = Modifier
.size(40.dp)
.clip(MaterialTheme.shapes.medium)
) {
AvatarURL(
// FIXME: URL can appearently be set before the image is available on the homeserver
url = roomSummary.avatarUrl,
)
}
},
supportingContent = {
// TODO: Display rsvpComment instead of alias
val canonicalAlias = roomSummary.canonicalAlias
if (canonicalAlias != null) {
Text(canonicalAlias)
}
},
)
DropdownMenu( ListItem(
expanded = expanded, modifier = Modifier.combinedClickable(
onDismissRequest = { expanded = false }, onClick = { openRoom() },
) { onLongClick = { expanded = true }
// TODO: Align me to the right ),
DropdownMenuItem( headlineContent = {
text = { Text(roomSummary.displayName)
Text(stringResource(id = R.string.main_room_leave_label)) },
leadingContent = {
Box(
modifier = Modifier
.size(40.dp)
.clip(MaterialTheme.shapes.medium)
) {
AvatarURL(
// FIXME: URL can appearently be set before the image is available on the homeserver
url = roomSummary.avatarUrl,
)
}
},
supportingContent = {
// TODO: Display rsvpComment instead of alias
val canonicalAlias = roomSummary.canonicalAlias
if (canonicalAlias != null) {
Text(canonicalAlias)
}
}, },
onClick = {
expanded = false
scope.launch { leaveRoom() }
}
) )
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
) {
// TODO: Align me to the right
DropdownMenuItem(
text = {
Text(stringResource(id = R.string.main_room_leave_label))
},
onClick = {
expanded = false
scope.launch { leaveRoom() }
}
)
}
} }
} }