From 7f639f6c24f6d49a63c95177b3363e066b344626 Mon Sep 17 00:00:00 2001 From: xfy Date: Sun, 24 May 2026 19:57:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20FAB=20=E8=8F=9C=E5=8D=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0"=E6=98=BE=E7=A4=BA=E8=B0=83=E4=BC=91"=E5=88=87?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA=E6=8E=92?= =?UTF-8?q?=E7=8F=AD=E6=A0=87=E8=AE=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CalendarViewModel 新增 toggleShowLegalHoliday() 方法 - FAB 菜单新增"显示调休"选项,选中高亮反馈开关状态 - DayCell 修复 showLegalHoliday=true 时个人排班标记样式: 从"浅色背景+浅色文字"改为"accent 色实心胶囊+白色文字" 默认模式(showLegalHoliday=false)恢复为无背景、直接浮于单元格 Co-Authored-By: Claude Opus 4.7 (1M context) --- .../kotlin/plus/rua/project/CalendarViewModel.kt | 7 +++++++ .../kotlin/plus/rua/project/ui/CalendarMonthView.kt | 13 +++++++++++++ core/src/main/kotlin/plus/rua/project/ui/DayCell.kt | 11 +++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/plus/rua/project/CalendarViewModel.kt b/core/src/main/kotlin/plus/rua/project/CalendarViewModel.kt index 9f838bd..12b12b4 100644 --- a/core/src/main/kotlin/plus/rua/project/CalendarViewModel.kt +++ b/core/src/main/kotlin/plus/rua/project/CalendarViewModel.kt @@ -186,6 +186,13 @@ class CalendarViewModel( } } + /** + * 切换法定调休角标显示。 + */ + fun toggleShowLegalHoliday() { + _showLegalHoliday.value = !_showLegalHoliday.value + } + /** * 从年视图选择月份后返回月视图。 */ diff --git a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt index 4982e39..a117ea9 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -388,6 +388,19 @@ fun CalendarMonthView( color = MaterialTheme.colorScheme.outlineVariant, modifier = Modifier.padding(horizontal = 8.dp) ) + MenuItem( + text = "显示调休", + selected = showLegalHoliday, + onClick = { + isMenuExpanded = false + viewModel.toggleShowLegalHoliday() + } + ) + HorizontalDivider( + thickness = 1.dp, + color = MaterialTheme.colorScheme.outlineVariant, + modifier = Modifier.padding(horizontal = 8.dp) + ) MenuItem( text = "关于", selected = false, 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 1c4791a..6d1990d 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt @@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -244,6 +245,12 @@ fun DayCell( } else { Modifier.padding(top = 1.dp, end = 2.dp) } + val shiftBackground = if (showLegalHoliday) { + Modifier.background( + shiftAccentColor.copy(alpha = shiftAlpha), + RoundedCornerShape(4.dp) + ) + } else Modifier Text( text = shiftLabel, color = shiftFgColor.copy(alpha = shiftAlpha), @@ -253,9 +260,9 @@ fun DayCell( modifier = Modifier .align(shiftAlignment) .zIndex(1f) - .background(MaterialTheme.colorScheme.background) + .then(shiftBackground) .then(shiftPadding) - .padding(horizontal = 2.dp) + .padding(horizontal = 3.dp, vertical = 1.dp) ) } if (showLegalHoliday && holidayBadge != null) {