This commit is contained in:
Joyeeta 2024-10-22 14:36:43 +05:30
Родитель 4053489067
Коммит 83c8e7376a
2 изменённых файлов: 126 добавлений и 76 удалений

Просмотреть файл

@ -135,32 +135,69 @@ import kotlinx.parcelize.Parcelize
import kotlin.math.abs
enum class AvatarType {
Person, Group, Overflow
Person,
Group,
Overflow
}
enum class AvatarSize {
Size16, Size20, Size24, Size32, Size40, Size56, Size72
Size16,
Size20,
Size24,
Size32,
Size40,
Size56,
Size72
}
enum class SlicedAvatarSize {
Size7, Size9, Size11, Size15, Size16, Size19, Size20, Size24, Size27, Size32, Size35, Size40, Size56, Size72
Size7,
Size9,
Size11,
Size15,
Size16,
Size19,
Size20,
Size24,
Size27,
Size32,
Size35,
Size40,
Size56,
Size72
}
enum class AvatarStatus {
Available, Away, Busy, DND, Blocked, Unknown, Offline
Available,
Away,
Busy,
DND,
Blocked,
Unknown,
Offline
}
enum class AvatarStyle {
Standard, StandardInverted, Anonymous, AnonymousAccent
Standard,
StandardInverted,
Anonymous,
AnonymousAccent
}
enum class ActivityRingSize {
Size16, Size20, Size24, Size32, Size40, Size56, Size72
Size16,
Size20,
Size24,
Size32,
Size40,
Size56,
Size72
}
enum class CutoutStyle {
Square, Circle
Square,
Circle
}
open class AvatarInfo(

Просмотреть файл

@ -55,80 +55,93 @@ fun AvatarPie(
) {
val slicedAvatarDimen = avatarSize / 2 - SPACER_SIZE / 2
if (noOfVisibleAvatars == 2) {
Row(
modifier = Modifier
.requiredSize(avatarSize)
.clip(CircleShape)
) {
SlicedAvatar(
group.members[0],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
size = size
)
AddVerticalSpacer()
SlicedAvatar(
group.members[1],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
size = size
)
}
RenderTwoSlices(avatarSize, slicedAvatarDimen, group, size)
} else if (noOfVisibleAvatars >= 3) {
Row(
modifier = Modifier
.requiredSize(avatarSize)
.clip(CircleShape)
) {
SlicedAvatar(
group.members[0],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen)
.align(Alignment.CenterVertically),
size = size
)
AddVerticalSpacer()
Column(
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
) {
SlicedAvatar(
group.members[1],
slicedAvatarSize = getSlicedAvatarSize(slicedAvatarDimen),
width = slicedAvatarDimen,
modifier = Modifier
.height(slicedAvatarDimen)
.width(slicedAvatarDimen),
size = size
)
AddHorizontalSpacer()
SlicedAvatar(
group.members[2],
slicedAvatarSize = getSlicedAvatarSize(slicedAvatarDimen),
width = slicedAvatarDimen,
modifier = Modifier
.height(slicedAvatarDimen)
.width(slicedAvatarDimen),
size = size
)
}
}
RenderThreeSlices(avatarSize, slicedAvatarDimen, group, size)
}
}
}
@Composable
private fun RenderTwoSlices(
avatarSize: Dp, slicedAvatarDimen: Dp, group: Group, size: AvatarSize
) {
Row(
modifier = Modifier
.requiredSize(avatarSize)
.clip(CircleShape)
) {
SlicedAvatar(
group.members[0],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
size = size
)
AddVerticalSpacer()
SlicedAvatar(
group.members[1],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
size = size
)
}
}
@Composable
private fun RenderThreeSlices(
avatarSize: Dp, slicedAvatarDimen: Dp, group: Group, size: AvatarSize
) {
Row(
modifier = Modifier
.requiredSize(avatarSize)
.clip(CircleShape)
) {
SlicedAvatar(
group.members[0],
slicedAvatarSize = getSlicedAvatarSize(avatarSize),
width = slicedAvatarDimen,
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen)
.align(Alignment.CenterVertically),
size = size
)
AddVerticalSpacer()
Column(
modifier = Modifier
.height(avatarSize)
.width(slicedAvatarDimen),
) {
SlicedAvatar(
group.members[1],
slicedAvatarSize = getSlicedAvatarSize(slicedAvatarDimen),
width = slicedAvatarDimen,
modifier = Modifier
.height(slicedAvatarDimen)
.width(slicedAvatarDimen),
size = size
)
AddHorizontalSpacer()
SlicedAvatar(
group.members[2],
slicedAvatarSize = getSlicedAvatarSize(slicedAvatarDimen),
width = slicedAvatarDimen,
modifier = Modifier
.height(slicedAvatarDimen)
.width(slicedAvatarDimen),
size = size
)
}
}
}
@Composable
private fun AddVerticalSpacer() {
Spacer(