|
1 | 1 | # Changelog |
2 | 2 |
|
3 | | -本文件记录 CountTimeProgressView 的所有重要版本变更。 |
| 3 | +This file records notable CountTimeProgressView changes. |
4 | 4 |
|
5 | 5 | ## [2.0.0] - 2026-04-15 |
6 | 6 |
|
7 | | -### Bug 修复 |
8 | | -- 修复 `CLOCK` 模式下 `minute >= 10` 时错误拼接 `hour` 的格式化 Bug |
9 | | -- 修复 `startAngle` getter/setter 语义不一致(用户设 0 读回 270 的问题) |
10 | | -- 修复 `titleCenterText` 在 SECOND 模式下的空指针崩溃风险 |
11 | | -- 修复 `DEFAULT_COUNT_TIME` 从 5ms 修正为 5000ms |
12 | | -- 修复 Demo 中 `setBackgroundColor()` 误调用(应为 `backgroundColorCenter`) |
| 7 | +### Bug Fixes |
| 8 | +- Fixed `CLOCK` formatting when `minute >= 10` incorrectly appended `hour` |
| 9 | +- Fixed inconsistent `startAngle` getter/setter semantics |
| 10 | +- Fixed a possible `titleCenterText` null crash in SECOND mode |
| 11 | +- Changed `DEFAULT_COUNT_TIME` from 5ms to 5000ms |
| 12 | +- Fixed the demo `setBackgroundColor()` call; it now uses `backgroundColorCenter` |
13 | 13 |
|
14 | | -### 新增功能 |
15 | | -- 暂停 / 恢复 / 重置动画:`pauseCountTimeAnimation()`、`resumeCountTimeAnimation()`、`resetCountTimeAnimation()` |
16 | | -- 进度 getter/setter:`progress` 属性(0f..1f) |
17 | | -- 进度变化回调:`addOnProgressChangedListener { progress, remainingMillis -> }` |
18 | | -- 自定义文本格式化器:`textFormatter = { millis -> "..." }` |
19 | | -- 进度条端点样式:`strokeCap`(BUTT / ROUND / SQUARE),支持 XML 配置 |
20 | | -- 动画插值器配置:`interpolator` 属性 |
21 | | -- 渐变色进度条:`gradientStartColor` / `gradientEndColor`,支持 XML 配置 |
22 | | -- XML 属性扩展:`autoStart`、`finishedText`、`showCenterText`、`strokeCap` |
23 | | -- `onMeasure` 支持 `wrap_content`(默认尺寸 84dp) |
24 | | -- SavedState 支持(屏幕旋转保持进度) |
25 | | -- 无障碍支持(AccessibilityNodeInfo) |
26 | | -- 显式单位 API:`setBorderWidthPx()`、`setMarkBallWidthPx()`、`setTitleCenterTextSizePx()` |
27 | | -- 公开 `remainingTime` 和 `isPaused` 属性 |
28 | | -- Jetpack Compose 适配工具类 `CountTimeProgressViewCompose` |
| 14 | +### Features |
| 15 | +- Pause / resume / reset APIs: `pauseCountTimeAnimation()`, `resumeCountTimeAnimation()`, `resetCountTimeAnimation()` |
| 16 | +- `progress` getter/setter in the 0f..1f range |
| 17 | +- Progress callback: `addOnProgressChangedListener { progress, remainingMillis -> }` |
| 18 | +- Custom text formatter: `textFormatter = { millis -> "..." }` |
| 19 | +- Progress stroke cap: `strokeCap` (BUTT / ROUND / SQUARE), with XML support |
| 20 | +- Configurable animation interpolator via `interpolator` |
| 21 | +- Gradient progress stroke via `gradientStartColor` / `gradientEndColor`, with XML support |
| 22 | +- XML attributes: `autoStart`, `finishedText`, `showCenterText`, `strokeCap` |
| 23 | +- `wrap_content` support in `onMeasure` with an 84dp default size |
| 24 | +- SavedState support for restoring progress after configuration changes |
| 25 | +- Accessibility support via AccessibilityNodeInfo |
| 26 | +- Explicit pixel APIs: `setBorderWidthPx()`, `setMarkBallWidthPx()`, `setTitleCenterTextSizePx()` |
| 27 | +- Public `remainingTime` and `isPaused` properties |
| 28 | +- `CountTimeProgressViewCompose` helper for Compose AndroidView usage |
29 | 29 |
|
30 | | -### 代码质量 |
31 | | -- 设置 `LinearInterpolator` 为默认插值器 |
32 | | -- 删除库中所有 `Log.e` 调用 |
33 | | -- 移除冗余 `mContext` 字段 |
34 | | -- 移除 `attr != null` 死代码分支 |
35 | | -- `calcRadius()` 改为 `private` |
36 | | -- `TextStyle` 添加 `@IntDef` 类型安全注解 |
37 | | -- `OnEndListener` 标记 `@Deprecated`,新增 `OnCountdownEndListener` + `setOnClickCallback` |
38 | | -- `onDetachedFromWindow` 不再清空 listener |
39 | | -- 重构 `onDraw` 为多个独立绘制方法 |
40 | | -- 性能:文本缓存、`postInvalidateOnAnimation()` 替代 `invalidate()` |
| 30 | +### Code Quality |
| 31 | +- Set `LinearInterpolator` as the default interpolator |
| 32 | +- Removed all `Log.e` calls from the library |
| 33 | +- Removed the redundant `mContext` field |
| 34 | +- Removed the dead `attr != null` branch |
| 35 | +- Made `calcRadius()` private |
| 36 | +- Added `@IntDef` type safety for `TextStyle` |
| 37 | +- Deprecated `OnEndListener` and added `OnCountdownEndListener` + `setOnClickCallback` |
| 38 | +- Stopped clearing listeners in `onDetachedFromWindow` |
| 39 | +- Split `onDraw` into focused drawing methods |
| 40 | +- Improved drawing performance with text caching and `postInvalidateOnAnimation()` |
41 | 41 |
|
42 | | -### 工程化 |
43 | | -- library 模块移除 AppCompat 运行时依赖(零第三方依赖) |
44 | | -- 迁移至 AndroidX |
45 | | -- `minSdk` 14 → 21,`targetSdk` / `compileSdk` → 34 |
46 | | -- 仓库改为 `google()` + `mavenCentral()` |
47 | | -- `lintOptions {}` → `lint {}` |
48 | | -- `proguard-android.txt` → `proguard-android-optimize.txt` |
49 | | -- `compileSdkVersion` → `compileSdk`,`minSdkVersion` → `minSdk` |
50 | | -- `artifactId` 从 `library` 改为 `counttimeprogressview` |
51 | | -- SplashActivity 从 Java 转换为 Kotlin |
52 | | -- 布局文件 `left/right` → `start/end`(RTL 支持) |
53 | | -- ScrollView 子 View 高度改为 `wrap_content` |
54 | | -- ImageView 添加 `contentDescription` |
55 | | -- 移除 `gradle.properties` 中硬编码的 JDK 路径 |
56 | | -- 新增 `ClockTimeFormatter` 独立工具类(便于单元测试) |
57 | | -- 新增 `formatClockTime` 单元测试(9 个用例) |
| 42 | +### Project |
| 43 | +- Removed AppCompat runtime dependency from the library module |
| 44 | +- Migrated to AndroidX |
| 45 | +- Raised `minSdk` from 14 to 21, and `targetSdk` / `compileSdk` to 34 |
| 46 | +- Switched repositories to `google()` + `mavenCentral()` |
| 47 | +- Migrated `lintOptions {}` to `lint {}` |
| 48 | +- Switched to `proguard-android-optimize.txt` |
| 49 | +- Migrated Gradle DSL names to `compileSdk` and `minSdk` |
| 50 | +- Changed `artifactId` from `library` to `counttimeprogressview` |
| 51 | +- Converted SplashActivity from Java to Kotlin |
| 52 | +- Replaced `left/right` layout attributes with `start/end` for RTL support |
| 53 | +- Changed ScrollView child height to `wrap_content` |
| 54 | +- Added ImageView `contentDescription` |
| 55 | +- Removed the hard-coded JDK path from `gradle.properties` |
| 56 | +- Added the standalone `ClockTimeFormatter` utility for unit testing |
| 57 | +- Added 9 unit tests for `formatClockTime` |
58 | 58 |
|
59 | | -### 文档 |
60 | | -- README / README-ZH:`compile` → `implementation`,修复中英文残片、默认值说明、拼写错误 |
61 | | -- 新增 CHANGELOG.md |
62 | | -- 新增 CONTRIBUTING.md |
63 | | -- 添加完整 KDoc 中文注释 |
| 59 | +### Documentation |
| 60 | +- Updated README / README-ZH from `compile` to `implementation` |
| 61 | +- Fixed mixed-language snippets, default value notes, and typos |
| 62 | +- Added CHANGELOG.md |
| 63 | +- Added CONTRIBUTING.md |
| 64 | +- Normalized source comments and public messages to English |
64 | 65 |
|
65 | 66 | ## [1.1.3] - 2017-11-11 |
66 | | -- 使用 Kotlin 重写代码 |
| 67 | +- Rewrote the code in Kotlin |
67 | 68 |
|
68 | 69 | ## [1.1.1] - 2017-03-27 |
69 | | -- 更新:退出时停止运行 |
| 70 | +- Stopped running when exiting |
70 | 71 |
|
71 | 72 | ## [1.1.0] - 2017-02-07 |
72 | | -- 更新:支持顺时针动画 |
| 73 | +- Added clockwise animation support |
73 | 74 |
|
74 | 75 | ## [1.0.0] - 2016-12-20 |
75 | | -- 首次提交 |
| 76 | +- Initial commit |
0 commit comments