24 Commits

Author SHA1 Message Date
xfy
8e65ae6f94 build: 缩小 app_icon 为 512x512 并转为 WebP,节省 446KB
原 2048x2048 PNG (457KB) → 512x512 WebP (11KB)。
同步更新 Platform.kt 中的资源引用。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 18:26:14 +08:00
xfy
9bd1f57daf build: 将 152 个 GIF 动画资源批量转换为 WebP 格式
使用 gif2webp -mixed -mt 批量转换,资源从 5.65MB 降至 3.60MB,
APK release 包从 7.8MB 降至 5.8MB(减少 26%)。

同步更新:
- 依赖:sketch-animated-gif → sketch-animated-webp
- 代码:GIF_FILES → WEBP_FILES,getGifUri → getWebpUri

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 18:04:36 +08:00
xfy
e02459e8c9 build: 删除未引用的 kotlin-test 条目,移除 @Preview,uiTooling 改为 debugImplementation
- 删除 libs.versions.toml 中未被任何模块引用的 kotlin-test 孤儿条目
- 移除所有 @Preview 注解和 Preview 函数(5 个文件)
- app/core 模块的 compose-uiTooling 从 implementation 改为
  debugImplementation,避免打包到 release APK

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 17:53:05 +08:00
xfy
dd072730f1 fix: 年视图 pageYear 使用 settledPage 计算,修复滑动切换时年份闪烁
pageYear = yearViewYear + (page - settledPage) 代替 currentPage,
因为 yearViewYear 由 settledPage 驱动,两者始终同步。
用 currentPage 会在滑动过半时出现不匹配,导致小月份
短暂显示错误年份数据。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 16:09:42 +08:00
xfy
2fc89d08c7 fix: 修复年视图翻页后共享元素转场动画失效
- 移除 baseYearForPager 和 scrollToPage(START_PAGE)
- HorizontalPager 的 pageYear 改用 yearViewYear + 相对偏移计算
- snapshotFlow 改为跟踪 settled page 差值更新 yearViewYear
- 避免再次进入年视图时强制滚动导致动画期间重组

Fixes #8

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 15:46:50 +08:00
xfy
ca02784d39 fix: 月视图和年视图添加背景色,修复共享元素过渡动画
在 CalendarMonthView 的月视图和年视图根布局添加
.background(MaterialTheme.colorScheme.background),确保共享元素
过渡时非共享元素有正确的背景动画(fade+slide)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:15:44 +08:00
xfy
0cdac663c9 refactor: 移除 fling 速度阈值,改用 spring 动画驱动折叠过渡
- ViewModel onDragEnd/onExpandDragEnd 移除 velocity 参数
- BottomCard 移除 VelocityTracker,简化回调签名
- CalendarMonthView 添加 animateFloatAsState spring 动画
- 更新单元测试:移除 fling 测试,调整阈值边界

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 13:36:58 +08:00
xfy
7f9db1dc1d perf: 聚合 CalendarUiState 减少 Compose 重组
- ViewModel 新增 CalendarUiState 数据类,通过 combine + stateIn
  将 6 个独立 StateFlow 合并为单一 uiState 流
- CalendarMonthView 从 5 个分散 collectAsState 改为单个
  uiState.collectAsState,减少重组次数
- CalendarPagerArea 改为显式传参,解耦对 ViewModel 的直接引用
- CalendarMonthPage 中 DayCell 外层包裹 key(dayData.date),
  稳定跨帧重组

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 11:09:05 +08:00
xfy
baedf878b4 perf: 动画性能优化 + 性能追踪工具
- CalendarMonthPage: 提取 WeekRow 子 Composable,graphicsLayer → offset + alpha
- DayCell: updateTransition → 独立 animateFloatAsState/animateColorAsState,
  共享 MutableInteractionSource 减少重组
- CalendarMonthView/WeekPager: graphicsLayer → offset + alpha,共享 interactionSource
- DEVELOPMENT.md: 补充性能追踪使用说明
- scripts/profile.sh: 新增 Perfetto trace 一键抓取脚本

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 10:29:58 +08:00
xfy
fb7e19ddc9 test: Wave 4 — 补充 fling 速度阈值交互测试
- test: onDragEnd 高速上滑强制折叠(无视 progress 阈值)
- test: onDragEnd 高速下滑强制展开(无视 progress 阈值)
- test: onExpandDragEnd 高速下滑强制展开
- test: onExpandDragEnd 高速上滑保持折叠

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:18:34 +08:00
xfy
6f4d62b78f refactor: Wave 3 — ViewModel 解耦 Compose 运行时,迁移到 StateFlow
- refactor: CalendarViewModel 从 mutableStateOf/Animatable 迁移到 StateFlow
- refactor: 继承 Android ViewModel,使用 viewModelScope 管理生命周期
- refactor: 拖拽/动画方法改为同步修改 StateFlow(移除协程 launch)
- refactor: onDragEnd/onExpandDragEnd 实现 fling 速度阈值判断
- refactor: BottomCard 解耦为纯参数驱动
- refactor: CalendarMonthView 使用 viewModel() + collectAsState()
- test: 适配 StateFlow API,139 测试全部通过

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:16:20 +08:00
xfy
774e03a928 refactor: Wave 2 — LunarCache 可注入化 + 重复计算提取
- refactor: LunarCache 从 object 单例改为 class + Mutex,方法改为 suspend
- refactor: DayCell 参数注入 lunarCache,remember → produceState
- refactor: 提取 MonthGridInfo/getMonthGridInfo 到 CalendarUtils
- refactor: CalendarViewModel init 块和 getMonthDays 复用 getMonthGridInfo
- refactor: calculateWeeksCount 委托给 getMonthGridInfo

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:58:35 +08:00
xfy
bf28008d17 refactor: Wave 1 — 构建清理、测试修复、文档修正、a11y 改进
- build: 清理版本目录死依赖(appcompat、core、material3)
- build: 精简 ProGuard keep 规则,仅保留热点路径和第三方库
- refactor: 重命名 PredictiveBackHandler → AppPredictiveBackHandler
- test: formatLunarDate 精确断言 + 闰月测试
- test: 统一测试命名风格(下划线),Unconfined → StandardTestDispatcher
- docs: 修正文档为纯 Android + Jetpack Compose 描述
- feat(a11y): 添加可访问性语义标注(WeekdayHeader heading、BottomCard 拖拽描述)
- feat: 为 DayCell、MonthHeader、WeekdayHeader、BottomCard 添加 @Preview

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 17:51:12 +08:00
xfy
2bd7d5ee19 perf: 移除临时性能监控日志,保留 Perfetto trace 标记
清理 ViewModel 和各 UI 组件中用于调试的 println 性能日志、
重组计数器和 System.nanoTime() 计时代码。正式的
composeTraceBeginSection/EndSection Perfetto/Systrace 标记继续保留,
用于生产环境性能分析。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 11:46:12 +08:00
xfy
98f3b71c4f perf: 升级 Macrobenchmark 至 1.4.1,适配新 API 并重新生成 Baseline Profile
- benchmarkMacro 1.3.4 → 1.4.1
- BaselineProfileGenerator: 使用 Direction 枚举替代坐标 swipe;
  用 executeShellCommand 绕过 startActivityAndWait(模拟器 software renderer
  不支持 gfxinfo framestats,会导致 amStartAndWait 超时)
- updateBaselineProfile task: 适配 1.4+ 的 startup-prof.txt 文件名格式,
  使用 layout.buildDirectory 预先计算路径(configuration cache 兼容)
- 重新生成 baseline-prof.txt(全量 AOT 覆盖)
- benchmark build type 设为 isDebuggable=true(配合模拟器运行)
- 将 Baseline Profile 使用文档从 README 迁移至 DEVELOPMENT.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 11:37:37 +08:00
xfy
2771e3733b perf: 集成 Macrobenchmark 模块,自动生成全量 Baseline Profile
- 新增 :macrobenchmark 模块,提供自动 Baseline Profile 生成
- 扩展 proguard-rules.pro,保留所有业务类方法名确保 profile 匹配
- 全量 AOT 覆盖:冷启动 + 交互路径(年视图、周折叠、关于页等)
- app/build.gradle.kts 新增 benchmark 构建类型
- README 简化 Baseline Profiles 维护指南

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 10:50:01 +08:00
xfy
6582d5970e perf: 集成 Baseline Profiles,优化启动性能与文档
- 添加 core/proguard-rules.pro 保留关键类方法签名
- 添加 core/src/main/baseline-prof.txt 预编译热点路径
- 引入 androidx.profileinstaller 依赖
- LunarCache 新增 formatLunarDate() 复用缓存数据
- BottomCard 使用 remember 缓存农历描述避免重复计算
- CalendarMonthView 延迟一帧显示 BottomCard,避免首帧阻塞
- README 补充 Baseline Profiles 维护指南与性能监控说明

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 10:22:43 +08:00
xfy
6aefaf33a6 perf: 提取农历/节气计算为 LunarCache LRU 缓存,添加启动预计算
- 新增 LunarCache 单例,LinkedHashMap(accessOrder=true) 实现 LRU 语义,
  @Synchronized 保护并发,容量 800 条,超限时淘汰 20%
- CalendarViewModel init 中在 Default 线程预计算当前月前后各 1 个月
- DayCell 移除内联 computeDayCellInfo 和 mutableMap 缓存,统一使用 LunarCache

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 09:50:48 +08:00
xfy
f6b5e62284 perf: 添加组件级性能监控日志
- CalendarViewModel: toggle/select 方法耗时打点
- CalendarMonthPage/CalendarPager/WeekPager/YearGridView: 重组次数与耗时日志
- CalendarMonthView: 使用 graphicsLayer 驱动 BottomCard 滑入动画

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 18:31:48 +08:00
xfy
27ba4f9f54 refactor: 月→年视图切换时不再强制展开折叠态
折叠状态下直接切换视图,sharedElement 从周视图缩小到
MiniMonth 的转场更自然。同时修复了重复的 trace begin。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:50:31 +08:00
xfy
2028897ce3 docs: 同步 AGENTS.md 文档,反映纯 Android 项目结构
- 更新所有层级 AGENTS.md 中的模块描述(:app / :core)
- 移除 KMP/iOS 相关引用,统一为纯 Android + Jetpack Compose
- 同步构建命令和测试路径

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:46:17 +08:00
xfy
e1345cc071 feat: 年月视图转场添加 BottomCard 滑入动画和淡入淡出效果
- CalendarMonthView: 为 BottomCard 添加滑入/淡出动效
- 优化 AnimatedContent 过渡:fade + slideInVertically/slideOutVertically
- YearGridView: 提取 sharedKey 变量

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:46:09 +08:00
xfy
9ad619c105 feat: 优化年月视图共享元素转场动画
- 月→年切换时自动展开折叠状态
- 将 sharedElement 精确绑定到日历网格区域
- YearGridView 为每个 MiniMonth 添加共享元素转场

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 16:17:16 +08:00
xfy
f5cc4ef2e5 refactor: 完成纯 Android 迁移,清理旧 KMP 模块并添加 app/core 新模块
- 删除遗留的 androidApp/、shared/ 等 KMP 结构文件
- 将新的 app/、core/ 纯 Android 模块纳入版本控制

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 15:55:08 +08:00