mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 10:56:48 +01:00
Generalize List counters
This commit is contained in:
@@ -206,56 +206,69 @@ fun PeopleListItem(
|
|||||||
contentDescription = stringRes(R.string.follow_set_icon_description),
|
contentDescription = stringRes(R.string.follow_set_icon_description),
|
||||||
modifier = Size50ModifierOffset10,
|
modifier = Size50ModifierOffset10,
|
||||||
)
|
)
|
||||||
Row(
|
DisplayParticipantNumberAndStatus(
|
||||||
modifier = Modifier.align(Alignment.BottomCenter).offset(y = (-5).dp),
|
modifier = Modifier.align(Alignment.BottomCenter),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
privateMembersSize = peopleList.privateMembersList.size,
|
||||||
horizontalArrangement = SpacedBy5dp,
|
publicMembersSize = peopleList.publicMembersList.size,
|
||||||
) {
|
)
|
||||||
if (peopleList.publicMembers.isEmpty() && peopleList.privateMembers.isEmpty()) {
|
|
||||||
Text(
|
|
||||||
text = stringRes(R.string.follow_set_empty_label2),
|
|
||||||
fontSize = Font10SP,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (peopleList.privateMembers.isNotEmpty()) {
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = SpacedBy2dp,
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Outlined.Lock,
|
|
||||||
modifier = Size10Modifier,
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = peopleList.privateMembers.size.toString(),
|
|
||||||
fontSize = Font10SP,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (peopleList.publicMembers.isNotEmpty()) {
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = SpacedBy2dp,
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Outlined.Public,
|
|
||||||
modifier = Size10Modifier,
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = peopleList.publicMembers.size.toString(),
|
|
||||||
fontSize = Font10SP,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DisplayParticipantNumberAndStatus(
|
||||||
|
modifier: Modifier,
|
||||||
|
privateMembersSize: Int,
|
||||||
|
publicMembersSize: Int,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier.offset(y = (-5).dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = SpacedBy5dp,
|
||||||
|
) {
|
||||||
|
if (privateMembersSize <= 0 && publicMembersSize <= 0) {
|
||||||
|
Text(
|
||||||
|
text = stringRes(R.string.follow_set_empty_label2),
|
||||||
|
fontSize = Font10SP,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (privateMembersSize > 0) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = SpacedBy2dp,
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Lock,
|
||||||
|
modifier = Size10Modifier,
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = privateMembersSize.toString(),
|
||||||
|
fontSize = Font10SP,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (publicMembersSize > 0) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = SpacedBy2dp,
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Public,
|
||||||
|
modifier = Size10Modifier,
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = publicMembersSize.toString(),
|
||||||
|
fontSize = Font10SP,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PeopleListOptionsButton(
|
private fun PeopleListOptionsButton(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
|||||||
Reference in New Issue
Block a user