feat: 完善壁纸应用功能并优化性能

## 主要功能改进

### 1. 修复壁纸引擎架构
- 将 WallpaperEngine 合并到 AutoWallpaperService 作为内部类
- 修复 WallpaperService.Engine 继承问题
- 修正 Paint 类导入,使用 android.graphics.Paint

### 2. 支持现代 Android 存储框架
- ImageLoader 支持 content:// URI 格式加载图片
- ImageScanner 支持 DocumentFile API 访问 SAF 文件夹
- 保留传统 File API 兼容性
- 持久化 URI 权限

### 3. 添加文件夹管理功能
- 新增文件夹列表展示,支持查看图片数量
- 实现文件夹移除功能,带确认对话框
- 使用 ViewHolder 模式优化列表性能
- 缓存图片数量,避免重复扫描

### 4. 优化用户体验
- 每次启用都弹出壁纸设置引导
- 添加进度条显示加载状态
- 首次启动显示使用指南
- 异步扫描文件夹,避免阻塞主线程

### 5. 资源文件完善
- 添加应用图标(自适应图标和传统图标)
- 创建应用主题 themes.xml
- 添加文件夹列表项布局 item_folder.xml
- 完善颜色资源定义

### 6. 性能优化
- 异步扫描大文件夹,避免卡顿
- 优先使用缓存数据,加快启动速度
- 异步加载图片数量统计
- ViewHolder 复用减少 findViewById 调用

### 7. 修复编译问题
- 解决 Kotlin stdlib 依赖冲突
- 修复 TextView 导入错误
- 移除有问题的 WallpaperEngine 独立类

## 技术改进

- 使用 DocumentFile.fromTreeUri() 处理 SAF 文件夹
- ContentResolver.openInputStream() 加载 URI 图片
- 异步任务优化 UI 响应
- 智能缓存策略减少 I/O 操作

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuangandClaude Sonnet 4.5 committed 2026-01-22 19:56:33 +08:00
1 parent 390d417f5b
commit d304297f2c
16 files changed
+759 -226

No files matched your search

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="@color/ic_launcher_foreground"
android:pathData="M54,19 C35.25,19 20,34.25 20,53 C20,71.75 35.25,87 54,87 C72.75,87 88,71.75 88,53 C88,34.25 72.75,19 54,19 ZM54,79 C39.64,79 28,67.36 28,53 C28,38.64 39.64,27 54,27 C68.36,27 80,38.64 80,53 C80,67.36 68.36,79 54,79 Z"/>
<path
android:fillColor="@color/ic_launcher_foreground"
android:pathData="M54,35 C47.37,35 42,40.37 42,47 C42,53.63 47.37,59 54,59 C60.63,59 66,53.63 66,47 C66,40.37 60.63,35 54,35 ZM54,55 C49.58,55 46,51.42 46,47 C46,42.58 49.58,39 54,39 C58.42,39 62,42.58 62,47 C62,51.42 58.42,55 54,55 Z"/>
</vector>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>