From 0fbbdfa444d3256c9ad3cf2e7b9a14edd7ec77ee Mon Sep 17 00:00:00 2001 From: xfy Date: Tue, 16 Jun 2026 18:04:07 +0800 Subject: [PATCH] feat: show rose day icon with priority over birthday crown --- .../kotlin/plus/rua/project/ui/DayCell.kt | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt b/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt index 4e5d864..f07f9d7 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt @@ -60,7 +60,8 @@ enum class DayCellState { } /** - * 单个日期单元格,显示日期数字并支持选中/今天/非当月状态;生日日期左上角显示金色皇冠。 + * 单个日期单元格,显示日期数字并支持选中/今天/非当月状态;玫瑰日日期左上角显示玫瑰图标, + * 生日日期左上角显示金色皇冠;若两者重合则优先显示玫瑰图标。 * * @param date 日期 * @param isCurrentMonth 是否属于当前显示月份 @@ -159,6 +160,16 @@ private fun DayCellImpl( } } + val isRoseDay = lunarData.isRoseDay + var roseClickTick by remember(date) { mutableIntStateOf(0) } + val roseScale = remember(date) { Animatable(1f) } + LaunchedEffect(roseClickTick) { + if (roseClickTick > 0) { + roseScale.animateTo(1.4f, spring(dampingRatio = Spring.DampingRatioMediumBouncy)) + roseScale.animateTo(1f, spring(dampingRatio = Spring.DampingRatioMediumBouncy)) + } + } + val annotationText = lunarData.annotationText val isAnnotationHighlight = lunarData.isAnnotationHighlight val holidayBadge = lunarData.holidayBadge @@ -321,7 +332,11 @@ private fun DayCellImpl( interactionSource = interactionSource, indication = null, onClick = { - if (isBirthday) birthdayClickTick += 1 + if (isRoseDay) { + roseClickTick += 1 + } else if (isBirthday) { + birthdayClickTick += 1 + } onClick() } ), @@ -373,7 +388,24 @@ private fun DayCellImpl( ) } } - if (isBirthday) { + if (isRoseDay) { + Icon( + painter = painterResource(R.drawable.ic_rose), + contentDescription = null, + tint = Color.Unspecified, + modifier = Modifier + .align(Alignment.TopStart) + .zIndex(1f) + .padding(start = 2.dp, top = 2.dp) + .size(14.dp) + .graphicsLayer { + rotationZ = -45f + transformOrigin = TransformOrigin.Center + scaleX = roseScale.value + scaleY = roseScale.value + } + ) + } else if (isBirthday) { Icon( painter = painterResource(R.drawable.ic_birthday_crown), contentDescription = null,