40 Commits

Author SHA1 Message Date
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
xfy
eb8b16047a Implement swipeable month view with HorizontalPager and assemble app
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:29:18 +08:00