51 Commits

Author SHA1 Message Date
meyou
043bd9824b 新增法定调休开关,默认禁用,排班接管右上角
ViewModel 增加 showLegalHoliday 状态,默认 false。
关闭时:排班从左上角移到右上角,不显示法定调休角标。
开启时:回到旧布局,左上角=排班、右上角=法定调休。
DayCell 与各 Pager 透传新参数,预留后续接入设置页。
2026-05-16 19:29:06 +08:00
meyou
ecf4cf601e 新增个人轮班 MVP:左上角胶囊显示班/休
新增 ShiftPattern 数据模型,以锚点日期 + 循环序列描述周期性轮班,与法定调休完全独立。
默认配置 2026-05-15 起 [班,班,休,休] 4 天周期,DayCell 左上角渲染胶囊角标。
2026-05-16 19:12:18 +08:00
meyou
aa223db519 年月视图切换时立即移除源视图,仅对目标视图播放缩放动画
之前月↔年切换使用交叉淡入:两层同时合成,源视图渐隐、目标视图渐显。
现改为单向过渡:先翻转 isYearView 让源视图立刻从合成中移除,
withFrameNanos 等一帧后再启动目标视图的 scale/alpha 动画,避免抖动。
2026-05-16 17:42:21 +08:00
meyou
c096651e0f Revert "修复首次启动切换年视图无动画的问题"
This reverts commit 216ebbf990555f8282371199b8d1cc4bb86d9b2e.
2026-05-16 17:02:45 +08:00
meyou
216ebbf990 修复首次启动切换年视图无动画的问题
始终组合年视图 HorizontalPager 层(通过 graphicsLayer.alpha=0 隐藏),
避免首次进入时 Pager 组合延迟导致动画首帧丢失。
2026-05-16 16:59:27 +08:00
meyou
8dad07c0a0 年视图支持左右滑动切换年份
使用 HorizontalPager 包裹年视图,支持手势滑动切年。
‹ › 按钮改为 animateScrollToPage,与滑动行为一致。
2026-05-16 16:43:32 +08:00
meyou
c996d026cc Replace year view month cells with mini calendar grids
Each month in the 4x3 year grid now shows a compact calendar with
day numbers, matching the iOS Calendar year view style. Today is
highlighted with a filled circle. Selected month title uses primary color.
2026-05-16 16:35:56 +08:00
meyou
731a1bb6a1 Wire year view into CalendarMonthView, MonthHeader and ViewModel
- CalendarViewModel: year view state and animation methods
- CalendarMonthView: graphicsLayer zoom overlay, BottomCard hiding
- MonthHeader: toggle year view on click, "今天" button
2026-05-16 16:29:37 +08:00
meyou
16b73c4373 Fix flash when expanding after navigating months in collapsed state
Sync CalendarPager's pagerState to selectedDate in CalendarMonthView
via LaunchedEffect(selectedDate), so the page is already correct when
CalendarPager re-enters composition during expand. Remove the now-
redundant LaunchedEffect(Unit) sync in CalendarPager.
2026-05-16 15:58:12 +08:00
meyou
b65856a4ae 点击月份标题跳转到今天 2026-05-16 14:54:35 +08:00
meyou
fcad070800 修复折叠态跨月周选中和展开闪跳问题
1. 展开同步逻辑移至 CalendarPager(LaunchedEffect(Unit)),减少闪帧
2. 跨月周根据滑动方向选中日期:
   - 后退到跨月周:选较晚月份1号,留在当月
   - 前进到跨月周:选该周周一,留在上个月
2026-05-16 13:38:34 +08:00
meyou
09e13e335c Revert 跨月周选中逻辑的两个提交,重新设计 2026-05-16 13:28:29 +08:00
meyou
857cf88cb0 修复跨月周选中逻辑:根据滑动方向决定选中日期
后退到跨月周(如从5月滑到4月27-5月3):选中较晚月份1号,留在当月。
前进到跨月周(如从4月滑到4月27-5月3):选中该周周一,留在上个月。
2026-05-16 13:22:47 +08:00
meyou
104c5e5baa 修复折叠态跨月周选中上个月日期的问题
跨月周(如5月第一周周一是4月27日)改为选中下个月的1号,
避免月份标题和展开内容不一致。
2026-05-16 13:10:03 +08:00
meyou
e403c683f6
Sync CalendarPager to selectedDate month when expanding from week view 2026-05-16 12:24:12 +08:00
xfy
f618d09458 Reformat code style across shared module
Apply consistent formatting: import ordering, line wrapping,
indentation, and XML normalization. No functional changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:57:18 +08:00
xfy
6351caf776 Add KDoc for public APIs, suppress monthNumber deprecation, and refine comments
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:41:54 +08:00
xfy
d0492d02f0 Fix collapse drag not tracking finger — use dynamic dragRange based on actual height change
The fixed DRAG_RANGE_DP=200dp caused the collapse progress to advance faster
than the visual height change, making the calendar feel like it "outruns" the
finger. Now dragRangePx is computed as (weeks-1)×rowHeight, matching the
actual visual height delta during collapse so finger movement maps 1:1 to
visual change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:29:24 +08:00
xfy
c751b56297 Fix row height measurement order and increase row padding
Move padding after onSizeChanged in CalendarMonthPage so row height
measurement excludes padding. Rename p→collapseProgress for clarity.
Add comments explaining grid height calculation and pager switching.
Increase ROW_PADDING_DP from 4 to 6.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:21:57 +08:00
xfy
85fe11d9f1 Animate card gap spacing with collapse progress
Card gap now interpolates between 24dp (expanded) and 12dp (collapsed)
instead of using a fixed value, providing a smoother visual transition.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:08:51 +08:00
xfy
5087bceb51 Add card gap spacing and header horizontal padding
Include CARD_GAP_DP in calendar area height calculation so BottomCard
positioning accounts for the gap. Add horizontal padding to MonthHeader
for better visual alignment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:05:44 +08:00
xfy
c8921e8641 Fix calendar height jitter when collapsing to week view
WeekPager had no height constraint (unlike CalendarPager which uses
pagerModifier with gridHeightPx), causing the pager to freely expand
instead of staying at the computed single-row height. Also, WeekPager
used 2dp row padding while CalendarMonthPage uses ROW_PADDING_DP (4dp),
creating a height mismatch at the switch point.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 13:12:58 +08:00
xfy
f189c188c7 Remove debug println logging and unused TAG constant
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 11:24:30 +08:00
xfy
c74de5f151 Add debug logging and fix gridHeightPx derivedStateOf state tracking
gridHeightPx changed from derivedStateOf to direct computation because
derivedStateOf cannot track non-State local variable changes, causing
gridHeightPx to not update when rowHeightPx transitions from 0 to measured value.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 11:21:29 +08:00
xfy
ddc852a667 Extract calendar utilities and use derivedStateOf for reactive state
Move shared constants and helper functions into CalendarUtils.kt,
replace manual state synchronization with derivedStateOf in
CalendarViewModel and UI composables.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 11:08:31 +08:00
xfy
7e972bb4fb Fix lint warnings: remove unused variable, replace monthNumber, use range check
- Remove unused currentWeeksCount variable and onWeeksChanged callback
- Replace deprecated monthNumber with month.number (requires explicit import)
- Remove all @Suppress("DEPRECATION") annotations for monthNumber
- Convert double comparison to range check (today in weekMonday..weekSunday)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:38:26 +08:00
xfy
b794601134 Fix style issues in MonthHeader and CalendarMonthView
Replace hardcoded padding values with constants, use Spacer instead of
space character for spacing, remove fontSize override on bodySmall, and
fix WeekdayHeader modifier order (padding before onSizeChanged).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:18:52 +08:00
xfy
ce6da44c52 Fix swipe interpolation discontinuity and remove debug println
Use currentPage instead of settledPage for interpolatedWeeks calculation
to prevent gridH jumps during month transitions. When offsetFraction is
near zero, compute weeks from currentPage rather than stale callback
state. Remove all debug println statements and TAG constants.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:08:25 +08:00
xfy
fbb7904880 Unify height calculation with effectiveWeeks and fix swipe interpolation continuity
Pass effectiveWeeks from CalendarMonthView through CalendarPager to
CalendarMonthPage so both use the same formula H*(1+(weeks-1)*(1-p)).
Fix interpolatedWeeks to anchor on settledPage instead of currentPage,
preventing direction/fraction discontinuity when currentPage jumps during
swipe transitions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 02:03:21 +08:00
xfy
b95f748839 Measure row height from DayCell instead of reverse-calculating from Column
Replace the fragile approach of computing rowHeightPx by dividing
Column height by weeks count with direct measurement via onSizeChanged
on the first DayCell row. Add estimated row height fallback based on
screen width and cell aspect ratio so the pager can be constrained
before the first measurement completes. Remove lockedRowHeightPx,
expandedWeeksCount, and calendarHeightPx state variables that are no
longer needed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:57:03 +08:00
xfy
785267b8bb Remove debug println statements from all calendar files
Clean up println debug logging and TAG constants added for
diagnosing the collapse animation issue. CalendarViewModel and
BottomCard restored to pre-debug versions; CalendarMonthView
and CalendarMonthPage cleaned inline.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:22:53 +08:00
xfy
266c3eede1 Pass locked rowHeightPx through CalendarPager to CalendarMonthPage
Add rowHeightPx parameter to CalendarPager and pass it through to
CalendarMonthPage. Remove onRowHeightMeasured callback which is no
longer needed since CalendarMonthPage now receives row height
externally. Update CalendarMonthView to pass rowHeightPx to CalendarPager.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:20:23 +08:00
xfy
acd6ff5236 Lock rowHeightPx during collapse animation
Add lockedRowHeightPx state that is only updated when fully expanded
(p < 0.01f). During collapse, rowHeightPx uses the locked value instead
of recalculating from the shrinking container height, which was causing
rowH to drop from 137→0 and gridH to become 0 at p=1.0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:15:21 +08:00
xfy
b94b264d5c Use dynamic row count (4/5/6) for calendar grid instead of fixed 6 rows
Calculate actual weeks needed per month and interpolate row count during
page swipe so BottomCard follows the grid height smoothly. Remove debug
println statements.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:31:29 +08:00
xfy
fae5908990 Prefer today over first-day when selecting date on page change
When swiping to a different month or week, select today if it falls
within the target period instead of always picking the 1st or Monday.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:42:07 +08:00
xfy
1cf2766e84 Increase row padding to 4dp and auto-select date on page change
Select the Monday of the week when WeekPager changes, and the 1st of
the month when CalendarPager changes, so the selected date always
matches the visible page.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:32:08 +08:00
xfy
a476ff01fc Add bottom padding to WeekdayHeader and account for it in collapse offset
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:24:56 +08:00
xfy
c1e0484cba Add pull-down gesture to expand from collapsed week view back to month view
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:02:44 +08:00
xfy
1c232762b1 Clip pager to bounds during collapse animation to prevent content overflow
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:55:04 +08:00
xfy
151b15d09e Replace Column layout with Box+manual y-offset for collapse animation
Switch CalendarMonthPage from Column to Box with calculated y positions per row,
enabling precise height computation that aligns with CalendarMonthView's
BottomCard positioning. Simplify cardTopPx calculation by deriving grid height
from the same formula instead of tracking expandedCalendarHeightPx separately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:49:45 +08:00
xfy
a44ef44b42 Refactor collapse animation to overlay selected row instead of shrinking rows
Selected row now moves up via offset + zIndex to cover other rows, which
stay in place. Collapse offset calculation excludes MonthHeader and
WeekdayHeader heights so only the grid portion is collapsed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:44:00 +08:00
xfy
d7552e469f Add KDoc and inline comments per COMMENTS.md conventions
- Add KDoc to all public Composable functions with parameter descriptions
- Add inline comments for non-obvious algorithms (42-cell grid, pager mapping)
- Add @Suppress reason comments for monthNumber deprecation
- Document collapseProgress range and physical meaning
- Add named constant comments for START_PAGE
- Add Preview name to App()

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:22:49 +08:00
xfy
0b9a516ed3 Fix BottomCard positioning by tracking expanded calendar height separately
Use expandedCalendarHeightPx to preserve full height during collapse animation,
and compute cardTopPx based on collapse state instead of offset arithmetic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:13:45 +08:00
xfy
f64a1c1851 Simplify BottomCard positioning with cardTopPx calculation instead of offset
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:48:05 +08:00
xfy
0bc5057986 Replace Column weight layout with Box absolute positioning for BottomCard collapse animation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:44:45 +08:00
xfy
35cbcaf430 Move collapse animation from animateFloatAsState to ViewModel Animatable with spring spec
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:32:43 +08:00
xfy
e53c3d8705 Add week/month view toggle with collapse animation and bottom card
Add isCollapsed/collapseProgress state to CalendarViewModel for toggling
between month and week views. CalendarMonthPage animates non-selected
weeks out with offset and alpha. Introduce WeekPager for single-week
HorizontalPager and BottomCard with drag-to-collapse gesture.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:28:05 +08:00
xfy
f3191aeac9 Move WeekdayHeader out of pager to keep it fixed across pages
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:56:15 +08:00
xfy
9424c518f3 Move horizontal padding from MonthHeader to CalendarMonthView outer column
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:52:13 +08:00
xfy
d7f09fb1f7 Add status bars padding and refine month header layout
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:49:01 +08:00