307 Commits

Author SHA1 Message Date
647823b66c
Merge pull request #1 from xunrua/main
重构日历折叠动画并修复折叠态下的多个交互问题
2026-05-17 09:02:52 +08:00
meyou
c95f118daf DayCell 关闭默认 ripple,消除选中后残留的灰色状态层
clickable 默认 indication 会在 release 后慢慢淡出灰色波纹,
选中态视觉已由 reveal 圆形动画承担,关闭默认 indication 即可
让点击反馈立即结束,不留灰色残影。
2026-05-16 19:40:47 +08:00
meyou
275fc55c79 选中态动画从 250ms 缩短到 150ms 让圆环填充消失更利落 2026-05-16 19:37:00 +08:00
meyou
6618c1863a 排班在右侧时沿用法定调休样式:surface 底 + 彩色文字
默认布局(showLegalHoliday=false)下,右上角排班从实心胶囊改为
surface 背景圆 + 班=primary/休=error 彩色文字,与开启法定调休
时右上角角标视觉规范一致。左上角(showLegalHoliday=true)保持
实心胶囊样式不变,用于区分两类信息。
2026-05-16 19:32:44 +08:00
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
f63b57eef1 角标加 surface 背景咬开描边圆,今日未选中时去掉描边只留 primary 文字
角标(休/班)从只是叠在描边圆之上,改为自带 surface 圆背景:
覆盖身后那段弧,产生"咬开圆环"的视觉断点。

同时 TODAY 状态(今日未被选中)去掉描边圆,文字仍保持 primary 主色,
通过文字颜色标识今天,与选中其他日期时形成更清晰的层次。
2026-05-16 18:56:02 +08:00
meyou
71a3cbc62a 选中态:今天=实心填充,非今天=描边圆,角标置顶不再被遮挡
之前所有选中态都是实心圆,描边圆只用于"今天未选中"。
现改为:今天+选中=primaryContainer 实心填充,普通日期+选中=primary 描边圆,
今天未选中维持细描边。
角标加 zIndex(1f) 提到最上,padding 收紧到 top=1/end=2 紧贴右上角方形空白,
配合描边圆改造,休/班角标在选中态下不再被圆形覆盖。
2026-05-16 18:47:57 +08:00
meyou
aa223db519 年月视图切换时立即移除源视图,仅对目标视图播放缩放动画
之前月↔年切换使用交叉淡入:两层同时合成,源视图渐隐、目标视图渐显。
现改为单向过渡:先翻转 isYearView 让源视图立刻从合成中移除,
withFrameNanos 等一帧后再启动目标视图的 scale/alpha 动画,避免抖动。
2026-05-16 17:42:21 +08:00
meyou
c28eb8d0e5 节日改为只在当天显示,休/班改为右上角角标
之前法定假期的「春节休」之类文本占据了整段假期,把假期里出现
的节气(雨水、惊蛰等)和其他节日全部挤掉。现在拆成两条线:

- 主标注:按 农历节日 → 节气当天 → 公历节日 → 农历日期 的
  优先级,仅在节日/节气当天展示节日名。
- 右上角角标:单独读取法定假期标志,调休「休」为 error 色,
  调休「班」为 primary 色;非当月时整体降低不透明度。

DayCell 外层多包一层 Box 承载 aspectRatio,原内层保留圆形裁
剪与涟漪;角标放在外层 TopEnd,避免被 CircleShape 裁掉。
2026-05-16 17:34:53 +08:00
meyou
889a54db0e 修复折叠周视图跨月日期未置灰的问题
WeekPager 之前把 isCurrentMonth 硬编码成 true,导致折叠状态下
当前周里属于上/下个月的日期没有变灰,与展开月视图的灰显约定不
一致。改为按 selectedDate 的年月判定(与 MonthHeader 显示的
月份一致),保持折叠前后的视觉一致性。
2026-05-16 17:30:51 +08:00
meyou
b730edc1eb 修复首次启动切换年视图无动画问题
通过 withFrameNanos 在动画前预留一帧,让年视图先完成首次合成与
布局,避免 HorizontalPager + YearGridView 的初次合成开销吃掉动
画时间段。与之前的「常驻合成」方案相比,本次只调时序、不动渲染
结构,因此不会再触发年视图层在隐藏时拦截触摸事件的回归。
2026-05-16 17:27:39 +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
142d0c235a 修复年视图布局和动画问题
- 年视图每个小月历添加星期行头部
- 日期列用 weight(1f) 对齐,去掉 CircleShape 裁剪
- 取消前一个动画 Job 防止快速点击时动画丢失
2026-05-16 16:49:10 +08:00
meyou
8dad07c0a0 年视图支持左右滑动切换年份
使用 HorizontalPager 包裹年视图,支持手势滑动切年。
‹ › 按钮改为 animateScrollToPage,与滑动行为一致。
2026-05-16 16:43:32 +08:00
meyou
502f1efc0a Fix year view showing stale year: reset to selectedDate.year on enter 2026-05-16 16:39:58 +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
995693cb5d Add year view with Hero Zoom transition
- CalendarViewModel: add isYearView, yearViewProgress, yearViewYear state
  with toggleYearView(), selectMonthFromYearView(), year navigation methods
- YearGridView: new 4x3 month grid with year navigation header
- MonthHeader: onClick now toggles year view, added "今天" button
- CalendarMonthView: overlay year view with graphicsLayer anchor-based
  scale transition, hide BottomCard during year view
2026-05-16 16:29:17 +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
b0b97650ec Fix week number alignment: use Bottom + padding instead of alignByBaseline
alignByBaseline caused layout jumps during AnimatedContent transitions.
Switch to Bottom alignment with 2dp bottom padding on week number for
stable visual alignment with month text baseline.
2026-05-16 15:45:03 +08:00
meyou
888c4d03d3 Use baseline alignment for month text and week number 2026-05-16 15:39:38 +08:00
meyou
418b97baed Fix week number baseline alignment and collapsed state today jump
- MonthHeader: align week number text baseline with month text (Bottom)
- WeekPager: scroll to selectedDate's week when it changes externally,
  fixing the case where clicking "back to today" in collapsed state
  didn't navigate the week pager to the current week
2026-05-16 15:32:26 +08:00
meyou
055738220c Add holiday, festival and solar term annotations to DayCell
Replace plain lunar text with priority-based annotations:
legal holidays > lunar festivals > solar terms > solar festivals > lunar day.
Holiday/festival text uses error color to stand out from regular lunar text.
2026-05-16 15:22:18 +08:00
meyou
dfda6fa5a9 DayCell 增加农历日期显示
使用 tyme4kt 库在日期数字下方显示农历日名,初一显示月名。
2026-05-16 15:15:27 +08:00
meyou
c86cdd61b8 修复 BottomCard 深色模式适配和 DayCell 无障碍支持 2026-05-16 14:57:24 +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
meyou
6a0ceaf8d3
Show anchor row background only after it reaches y=0 2026-05-16 11:29:13 +08:00
meyou
9544cb7526
Only show anchor row background during collapse, not on initial render 2026-05-16 11:24:34 +08:00
meyou
7c6c32486d
Only add background to anchor row during collapse 2026-05-16 11:18:09 +08:00
meyou
9a0c8771a1
Add row background color to prevent text bleed during collapse animation 2026-05-16 11:10:30 +08:00
meyou
666dae3b9d
Rewrite collapse animation as two-phase whole-block slide-up
Phase 1: all rows slide up together until selected row reaches y=0.
Phase 2: rows below selected row slide up as a group.
No per-row height scaling, only y-offset translation + fade.
2026-05-16 11:02:59 +08:00
meyou
9584d46247
Change collapse animation to staggered row slide-up with fade-out
Rows now keep full height and slide upward sequentially instead of
compressing. The anchor row (selected) moves to y=0 and stays fixed;
other rows exit top-to-bottom with staggered timing.
2026-05-16 10:54:07 +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
d755178b81 Add AnimatedContent slide+fade transition to MonthHeader month and week number text
When month or week number changes, the text slides vertically with fade:
upward for increasing values, downward for decreasing values, using
slideInVertically/slideOutVertically with tween(250).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:50:15 +08:00
xfy
8913e5ff0d Add circular reveal animation to DayCell with animated state transitions
Replace hard-switched background/border modifiers with updateTransition-based
animated properties: revealProgress for circular indicator radius, contentColor
and selectedColor via animateColor, borderAlpha for today stroke. Use drawBehind
for custom circle drawing with tween(250, FastOutSlowInEasing) spec.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:49:12 +08:00
xfy
2411416eb7 Add page fade-in/fade-out transition to CalendarPager and WeekPager
Use pagerState.currentPageOffsetFraction to compute alpha for page content:
alpha drops from 1 to 0 as offset goes from 0% to 30%, preventing
mid-point brightness dip (combined alpha of adjacent pages always >= 1f).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:47:23 +08:00
xfy
11ace14e10 Add fade-out effect for non-selected rows during calendar collapse
Non-selected rows now fade out with alpha = 1f - collapseProgress via
graphicsLayer, naturally following the spring animation curve. When
rowScale < 0.1f and collapseProgress > 0.9f, DayCell rendering is
skipped and replaced with an empty Spacer to reduce draw overhead at
the end of the collapse animation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:46:47 +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
270346e6ef Lower collapse threshold to 25% for easier fold/unfold triggering
Collapse triggers when progress > 0.25 (was 0.5). Expand triggers when
progress < 0.75 (1 - threshold), creating asymmetric thresholds that make
both fold and unfold easy to trigger with a short drag.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:52:23 +08:00
xfy
69e49b5d81 Add fling velocity threshold to collapse/expand drag gesture
Quick swipe now snaps to the target state regardless of progress position,
matching the behavior of HorizontalPager's fling logic. Uses VelocityTracker
to measure release velocity and a 800 dp/s threshold (FLING_VELOCITY_THRESHOLD_DP).
Slow drags still use the positional COLLAPSE_THRESHOLD (50%) as before.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:49:32 +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
73d42902ea Update targetSdk to 37, Gradle to 9.5.1, coroutines-test to 1.11.0, and move launcher icon out of drawable-v24
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:07:48 +08:00
xfy
36debfd4a5 Add Aliyun Maven mirrors for faster dependency resolution
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:49:51 +08:00