283 Commits

Author SHA1 Message Date
xfy
bc9c10d82e feat: 日期检查器添加新行自动滚动与高亮动画
- 点击 FAB 添加新行后自动滚动到列表底部
- 新增行短暂高亮显示(primaryContainer 背景色)
- LazyColumn 添加 animateItem() 提升列表动画体验

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 15:39:43 +08:00
xfy
b12206dc88 feat: 日期检查器 UI 改版,添加过期状态显示
- 生产日期改为渐变卡片展示,支持点击切换日期
- 保质期条目改为 ExpiryCard,显示过期状态标签
- 新增 ExpiryStatus 枚举(SAFE/WARNING/URGENT/EXPIRED)
- 新增 ArrowRightIcon 自定义图标
- 添加中文日期格式化辅助函数
- 改进 TopAppBar 和 FAB 样式

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 14:12:41 +08:00
xfy
23909e855f refactor: 简化 BottomCard 年视图切换动画并移除调试日志
- 将 slideAnim 初始值固定为 1f(屏幕外),简化年↔月切换逻辑
- 移除 BottomCard 区域的调试 logd 日志
- fadeIn easing 从 FastOutSlowInEasing 改为 LinearOutSlowInEasing

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 14:00:18 +08:00
xfy
be023a00a9 refactor: 优化年份视图切换动画,使用 Animatable 精确控制
- 用 Animatable + LaunchedEffect 替换 animateFloatAsState
  实现滑出/滑入分阶段动画序列(先滑出再滑入)
- 统一缩放/淡入淡出动画时长为 350ms
- 底部卡片滑出偏移从 200.dp 增加到 300.dp

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 13:47:36 +08:00
xfy
f34e34e5ae feat: 引入 YaYaTheme 并应用到所有 Activity
新增 Theme.kt 提供 Android 12+ 动态颜色支持,
为全部 5 个 Activity 的 setContent 包裹 YaYaTheme。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 13:25:27 +08:00
xfy
2b0491d7d7 chore: 添加 .editorconfig 配置 ktlint Composable 函数命名规则
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 13:20:55 +08:00
xfy
a8717dec7d refactor: MenuItem 和 ToolItem 统一使用 Card(onClick) 2026-06-01 13:18:27 +08:00
xfy
6446d6636e refactor: 移除 LicensesScreen 调试日志
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 11:44:15 +08:00
xfy
c72120ee0a fix: 开源许可列表项改用 Card(onClick) 以支持点击动画
原实现使用 Column + Modifier.clickable 在 LazyColumn 中无法显示
ripple 反馈。改用 Material3 Card 的 onClick 参数后,点击水波纹
动画正常显示。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 11:42:49 +08:00
xfy
acb737dd25 refactor: 简化 holiday badge 空值检查为 Elvis 运算符 2026-06-01 11:18:10 +08:00
xfy
4a8480be64 feat: 移除共享元素转场,月/年视图切换改用缩放+淡入淡出动画 2026-06-01 11:11:45 +08:00
xfy
1930bbcb7f feat: 添加 Perfetto trace 分析脚本并更新开发文档 2026-05-27 18:10:53 +08:00
xfy
6dffaf4c91 feat: 法定假日背景添加波浪缩放动画
点击"显示调休"后,假日格子背景从左上到右下依次缩放弹出(每格延迟15ms),
关闭时反向缩放消失,使用 graphicsLayer 实现高性能动画。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 17:41:18 +08:00
xfy
3c1a04580c 更新 baseline profile 和优化基准测试生成器 2026-05-27 17:13:16 +08:00
xfy
281abcf66b perf: 添加性能追踪标记并改进基线配置文件生成器 2026-05-27 16:06:05 +08:00
xfy
4de00e35dc Update baseline profile for performance optimization 2026-05-27 11:14:07 +08:00
xfy
4eadc479eb feat: 添加 testTag 基础设施,扩展 Baseline Profile 覆盖路径
为 CalendarPager、BottomCard、FAB、工具页、日期检查器等关键 UI 元素添加 testTag,
启用 testTagsAsResourceId 支持 UI Automator 通过 resource-id 定位。
BaselineProfileGenerator 使用 testTag 选择器重写,覆盖工具页、日期检查器、
DatePicker 等更多导航路径。清理 DEVELOPMENT.md 移除已过时的性能瓶颈描述。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 10:03:16 +08:00
xfy
9a0222b4a2 perf: 引入 logd 条件日志工具,增强动画调试并优化 sharedElement 缓存
- 新增 AnimLog.kt,提供 BuildConfig.DEBUG 条件控制的 logd 日志工具,
  支持 lambda 延迟求值以避免 release 模式下的字符串拼接开销
- 全模块替换 android.util.Log.d 为 logd,并将日志重构为 lambda 形式
- CalendarViewModel: toggleYearView / selectMonthFromYearView 添加纳秒级
  耗时追踪日志
- CalendarMonthView / CalendarMonthPage / CalendarPager / YearGridView:
  增加重组/进入/离开/页面切换/动画状态变化的详细调试日志
- 折叠动画/滑动进度日志添加状态去重,避免频繁重复输出
- P0: 缓存 sharedElement tween 实例(CalendarMonthView + YearGridView),
  避免每次重组创建新实例导致动画重新计算
- P0: YearPager pageYear 使用 remember 稳定计算,避免 settledPage 与
  yearViewYear 不同步导致抖动
- 移除 YearPager crossFadeAlpha,改为无透明度渐变
- app/build.gradle.kts 添加 profileinstaller 依赖

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:27:07 +08:00
xfy
20425e392c fix: 恢复折叠动画 Phase 2 下方行偏移,移除 showWeekPager 切换
- 恢复 CalendarMonthPage 中 isBelow 行的 `- phase2 * belowRowsHeight`
  (2592a5f 误删导致展开时下方行原地淡入而非滑出)
- 移除 CalendarMonthView 的 showWeekPager + AnimatedContent 切换
  (完全折叠后下拉拖拽时只显示 WeekPager 单周,上下空白)
- 回退到始终显示 CalendarPager,由 CalendarMonthPage 处理折叠动画
- 添加详细动画调试日志(Page/WeekRow/View 三层)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 17:39:40 +08:00
xfy
2592a5fa55 feat: 使用 AnimatedContent 平滑切换 CalendarPager ↔ WeekPager
- 用 AnimatedContent 包装 pager 切换,添加 fadeIn/fadeOut 过渡
- 延迟 50ms 切换避免折叠 spring 动画期间的视觉跳跃
- 修复 WeekRow 下方行的 yOffset 计算(移除 phase2 项)
- WeekPager 添加农历缓存支持
- 添加折叠动画调试日志

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 14:18:50 +08:00
xfy
4c53f234cf fix: 去掉 CalendarPager ↔ WeekPager 切换,修复折叠闪烁
CalendarPager 在 collapseProgress=1.0 时只渲染 anchor 行,
效果和 WeekPager 相同,但避免了切换导致的视觉跳跃。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 13:54:02 +08:00
ea7558dec8
Merge pull request #9 from xunrua/main
优化年月切换卡顿
2026-05-26 09:37:41 +08:00
xfy
47876a233b feat: 添加 PowerShell 性能追踪脚本
一键抓取 Perfetto trace、帧统计、内存信息并生成 Markdown 报告

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 08:12:48 +08:00
meyou
dfb820d610
Revert "feat: 添加年月滚轮选择器,支持触觉反馈"
This reverts commit bbe51051ae83d56fda8ad965f7b73a014ddea7b8.
2026-05-26 07:33:15 +08:00
meyou
0b6d9ea87a
fix: 滚轮选择器仅在滚动停止后触发选中变更和触觉反馈
快速滑动时不再每帧更新 selectedIndex,改为等滚动停止后
计算最终中心项再触发回调,消除来回抽搐问题。
2026-05-25 23:38:59 +08:00
meyou
bbe51051ae
feat: 添加年月滚轮选择器,支持触觉反馈
- 新增 WheelPicker composable:惯性吸附 + 触觉反馈滚轮
- 新增 MonthYearPickerDialog:年月双滚轮选择弹窗
- 新增 YearPickerDialog:年份滚轮选择弹窗
- MonthHeader:点击年月文字弹出年月选择器
- YearHeader:点击年份文字弹出年份选择器
- 滚动时触发 HapticFeedbackConstants.CLOCK_TICK 触觉反馈
2026-05-25 23:34:25 +08:00
meyou
6fac313fdf
perf: 延迟 YearGridView 文本测量到第二帧,补充性能分析文档
YearGridView 首帧 168ms 中约 24ms 来自 remember 同步文本测量。
将 dayLayouts/titleLayouts/weekdayLayouts 改为 produceState,
首帧 Canvas 渲染为空(sharedElement 结构不变),第二帧填充内容。

DEVELOPMENT.md 补充已知性能瓶颈分析和 Baseline Profile 覆盖建议。
2026-05-25 23:19:58 +08:00
meyou
ce84c614de
fix: 恢复 AnimatedGif 弹跳动画和 YearGridView 全量 sharedElement
- AnimatedGif: 恢复原始 scale 弹跳入场动画,仅保留 repeatCount 限制
- YearGridView: 恢复所有 12 个月的 sharedElement,保证点击任意
  月份都有正确的共享元素转场动画
- CalendarPager: beyondViewportPageCount 1→0 保留(无视觉影响)
2026-05-25 23:06:15 +08:00
meyou
5158b99800
perf: 优化年月切换卡顿
Perfetto trace 分析:
- YearGridView 首帧 168ms: 12 个 MiniMonth 各创建 sharedElement
  节点,但仅 1 个 key 匹配 CalendarPager
- compose:lazy:prefetch 最长 703ms: CalendarPager 预加载相邻页

修复:
- YearGridView: 仅选中的月份使用 sharedElement(11→1 个),
  减少首次组合的 modifier 节点创建开销
- CalendarPager: beyondViewportPageCount 1→0,消除预加载卡顿
2026-05-25 22:57:18 +08:00
meyou
80ab328906
perf: 限制 WebP 动画重复次数并简化入场动画,减少帧丢失
Perfetto trace 分析显示 75.6% 帧延迟,根因为 250x250 WebP
持续以 11-14 FPS 无限循环解码。每次解码周期导致 4-26 帧延迟。

- AnimatedGif: repeatCount(2) 限制动画播放 3 次后停止
- AnimatedGif: 移除两阶段弹跳动画,改为 150ms 淡入
- README: 添加构建命令和产物路径
2026-05-25 22:43:45 +08:00
meyou
a84e1b9528
fix: 移除农历初一月份名称重复的后缀"月"
lunarMonth.getName() 返回的月份名称已包含"月"字,
如"三月"、"四月",无需再手动拼接。
2026-05-25 22:01:06 +08:00
xfy
bb0a72006d revert: 回退 graphicsLayer 优化,实机 GPU 合成开销过大
graphicsLayer 创建的离屏 layer 在实体机上导致 slow draw commands 激增,
整体体验比重组更卡。回退以下改动:

- WeekRow: graphicsLayer → offset + alpha
- CalendarPager: graphicsLayer → alpha
- WeekPager: graphicsLayer → alpha
- YearGridView: graphicsLayer → alpha
- BottomCard: graphicsLayer → offset + alpha
- layoutReady: graphicsLayer → alpha

保留的优化:
- DayCell produceState 上移(42 协程 → 1 协程)
- remember 稳定化 lambda 和计算

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 17:25:22 +08:00
xfy
73b176a95e perf: remember 稳定化 lambda 和计算,减少重组传播
- weekNumber: remember(selectedDate) 缓存 getIsoWeekNumber 结果
- onDateClick/onMonthChanged/shiftKindAt: remember 稳定化,避免每次重组创建新 lambda
- onRowHeightMeasured: remember 稳定化

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:58:46 +08:00
xfy
6a4907f465 perf: layoutReady alpha() → graphicsLayer
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:55:15 +08:00
xfy
4664d352bd cleanup: 移除 CalendarMonthView 冗余的 offset 导入
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:51:12 +08:00
xfy
297a7a54d4 perf: 年视图/BottomCard alpha+offset → graphicsLayer
- YearGridView crossFadeAlpha: alpha() → graphicsLayer(年视图翻页淡入淡出)
- BottomCard slideProgress: offset()+alpha() → graphicsLayer(年视图切换滑出)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:50:02 +08:00
xfy
55000f64c9 perf: WeekPager alpha() → graphicsLayer 避免滑动重组
与 CalendarPager 同样的问题:周视图滑动时 alpha 每帧变化触发重组。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:48:09 +08:00
xfy
01a7d7aed8 perf: CalendarPager alpha() → graphicsLayer 避免滑动重组
月份切换滑动时 pageOffset 每帧变化,alpha() Modifier 触发重组。
改用 graphicsLayer 在 draw 阶段更新透明度,跳过 Composition/Layout。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:47:04 +08:00
xfy
da46204de4 perf: DayCell produceState 上移到页面级,减少协程数量
CalendarMonthPage 统一预计算整月 42 天的 lunarData(1 个协程),
通过参数传入 DayCell,避免每个单元格独立启动 produceState(42 协程)。

- holidayBadges produceState 扩展为 lunarDataMap,存储完整 DayCellInfo
- DayCell 添加可选 lunarData 参数,条件分支调用 DayCellImpl
- WeekPager 保持向后兼容(不传 lunarData 时内部获取)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:44:06 +08:00
xfy
e175bb07da perf: WeekRow 改用 graphicsLayer 避免折叠动画重组
将 offset() + alpha() 替换为 graphicsLayer { translationY / alpha },
collapseProgress 变化时跳过 Composition/Layout,仅更新 Draw 阶段。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:38:04 +08:00
xfy
6ab63eae53 fix(profile.sh): 修复帧率和内存数据提取逻辑
- Janky frames 百分比:grep -oP 替换为 BSD awk 兼容的 substr+index
- Slow UI thread / Slow draw commands / High input latency:改用 $NF 提取最后一个字段,
  避免 "Slow UI thread" 等中间空格导致 awk 列错位
- Java Heap / Native Heap:改用 $3 提取,避免 "Java Heap:" 中 $2 是 "Heap:" 而非数值
- 所有指标改用 awk + exit 取第一个匹配(整体统计),避免 tail -1 取到 per-window 数据

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:27:21 +08:00
xfy
a431dcdfbf feat: 添加 trace 构建类型 + 增强性能追踪脚本
- ComposeTrace 改用 BuildConfig.ENABLE_TRACE 控制,release 关闭,debug/trace 开启
- core/app 添加 trace buildType:release 优化(R8 + shrink resources)+ 保留 trace 标记
- CalendarMonthView/WeekPager 添加更多自定义 trace marker,覆盖年月视图切换路径
- profile.sh 增强:
  - 添加 --trace 参数支持 trace 构建
  - Perfetto 配置增加 gpu.memory 和 surfaceflinger.frametimeline 数据源
  - 报告自动提取帧率百分位、jank 比例、内存摘要
  - 添加年月视图切换专项分析指南和基线对比方法

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 16:19:21 +08:00
xfy
28f777abe4 perf: 优化 Compose 渲染性能
- DayCell: 5 个 animate*AsState 合并为 updateTransition,减少 80% 动画状态对象
- CalendarMonthPage: produceState/remember key 从 List/Map 改为 year/month 原始值
- CalendarPager: derivedStateOf 提取 currentPageOffsetFraction,beyondViewportPageCount 设为 1
- CalendarViewModel: 三层嵌套 combine 扁平化为 6 参数 combine

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 15:36:18 +08:00
xfy
e934d33cfa cleanup: ComposeTrace 仅在 debug 构建中启用
- core/build.gradle.kts: 启用 buildConfig 生成
- ComposeTrace: 添加 BuildConfig.DEBUG 条件,release 构建中空操作
  避免 R8 full mode 下 Trace 调用的生产环境开销

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 15:15:29 +08:00
xfy
dead12fdf4 cleanup: 提取 Activity 基类、修复 Compose 状态、精简资源
A. 提取 Activity 共用代码:
- 新增 BaseActivity 基类,统一处理 enableEdgeToEdge 和 slide 转场动画
- 5 个子 Activity 从 ~212 行简化为 ~50 行,减少 150+ 行重复代码

B. 修复 Compose 状态问题:
- BottomCardArea: 移除对 selectedDate/isCollapsed 的独立 StateFlow 订阅,
  统一使用 uiState 聚合流
- 替换脆弱的 SideEffect 帧计数器为显式 LaunchedEffect + delay(32)

C. 资源精简:
- 删除 mipmap-mdpi 和 mipmap-hdpi 密度(现代设备已被覆盖)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 15:08:00 +08:00
xfy
5bac114c16 cleanup: 移除冗余依赖、死代码和构建配置
- core: 移除未使用的 uiTooling/uiToolingPreview debug 依赖
- app: 删除冗余 ndk abiFilters、bundle.language、netty pickFirsts
- app: 修复 packaging.excludes 花括号展开语法
- Platform: 删除死代码 AppPredictiveBackHandler 及未使用 import
- CalendarMonthView: 删除重复 import animateFloatAsState

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 14:53:39 +08:00
xfy
57eae41c65 feat: 日期检查器页面实现商品过期检查功能
- 顶部生产日期选择器(TextField + DatePickerDialog)
- 默认三行(30/60/180天),天数与到期日期双向联动
- 滑动删除行
- 底部右侧 FAB 添加新行
- 日期格式 ISO YYYY-MM-DD

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 10:58:17 +08:00
xfy
93c02810bf feat: 工具页面添加"日期检查器"入口,支持跳转详情页
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 10:24:12 +08:00
xfy
e30540b2dc feat: FAB 菜单添加"工具"入口,跳转空白工具页面
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 10:20:36 +08:00
xfy
134fc5a9c6 fix: 排班标记添加圆形底,避免与选中圆环重叠
- 将右上角排班 Text 包裹在 Box 中
- Box 添加 CircleShape + 背景色,遮挡选中状态的描边圆环
- 非选中时背景色与 cell 背景一致,视觉上仍是裸文字

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 10:12:58 +08:00