269 Commits

Author SHA1 Message Date
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
xfy
2ba3cc5d42 Add logs/ to .gitignore
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 10:12:15 +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
7e2bb048f6 Unify row height source in CalendarMonthPage
Replace internal rowHeightPx measurement with external rowHeightPx
parameter passed from CalendarMonthView. This eliminates the mismatch
between outer gridHeightPx (based on shrinking container) and inner
totalHeightDp (based on independently measured row height), which was
causing visual jitter during collapse animation.

Remove onRowHeightMeasured callback, TAG constant, and debug printlns
from CalendarMonthPage as part of this refactor.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:17:00 +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
591215251f Use JAVA_HOME JDK instead of pinned toolchain version 21
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 23:59:40 +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
98e91c273e Rewrite README as project overview and add development guide
Replace the default KMP template README with a concise project description
in Chinese, and add DEVELOPMENT.md with setup, build, test, and convention
instructions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:01:03 +08:00
xfy
bacc2bc8dc Use primaryContainer colors when today is also selected
Distinguish the selected-today state from regular selection by using
primaryContainer/onPrimaryContainer instead of primary/onPrimary,
providing a softer visual treatment for the combined state.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:53:33 +08:00
xfy
de8cb4334b Use border outline instead of filled background for today indicator
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:50:25 +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
e5d7efd603 Skip initial snapshotFlow emission in pagers to preserve today selection
Adding .drop(1) prevents the settledPage flow from firing on initial
composition, which would override the "today" date selection.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:37:27 +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
2fb36168a3 Change collapse animation to shrink non-selected rows instead of overlaying
Non-selected rows now compress their height proportionally with
collapse progress, replacing the previous overlay-based approach.
Remove KDoc that described the old overlay behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:50:22 +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
edf8ea9851 Fix first-frame flicker by deferring row height until measured
When rowHeightPx is 0 (first frame), use aspectRatio-based natural
height instead of collapsing to 0.dp, preventing a visible flash.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:27:26 +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