94 Commits

Author SHA1 Message Date
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
xfy
9648afc561 Add unit tests for CalendarViewModel and CalendarUtils
Inject Clock into CalendarViewModel for testability, add kotlinx-coroutines-test dependency, replace placeholder test with real coverage for ISO week numbers, month day grids, page mapping, and utility functions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:42:01 +08:00
xfy
3599ff448c Update compileSdk to 37, Compose to 1.11.0, and remove unused dependencies
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:40:08 +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
1db84d2d0e Adjust header vertical padding for better spacing
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 13:25:07 +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
3612efb665 Replace deprecated dayOfMonth with day and fix naming conventions
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:55:04 +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