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

+16
View File
@@ -0,0 +1,16 @@
<?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_background"
android:pathData="M0,0 L108,0 L108,108 L0,108 Z"/>
<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,16 @@
<?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_background"
android:pathData="M0,54 C0,24.2 24.2,0 54,0 C83.8,0 108,24.2 108,54 C108,83.8 83.8,108 54,108 C24.2,108 0,83.8 0,54 Z"/>
<path
android:fillColor="@color/ic_launcher_foreground"
android:pathData="M54,25 C38.54,25 26,37.54 26,53 C26,68.46 38.54,81 54,81 C69.46,81 82,68.46 82,53 C82,37.54 69.46,25 54,25 ZM54,75 C42.4,75 33,65.6 33,54 C33,42.4 42.4,33 54,33 C65.6,33 75,42.4 75,54 C75,65.6 65.6,75 54,75 Z"/>
<path
android:fillColor="@color/ic_launcher_foreground"
android:pathData="M54,39 C48.48,39 44,43.48 44,49 C44,54.52 48.48,59 54,59 C59.52,59 64,54.52 64,49 C64,43.48 59.52,39 54,39 ZM54,55 C50.69,55 48,52.31 48,49 C48,45.69 50.69,43 54,43 C57.31,43 60,45.69 60,49 C60,52.31 57.31,55 54,55 Z"/>
</vector>