Files
bzForGk2/app/build.gradle
T
hughhuangandClaude Sonnet 4.5 d304297f2c 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>
2026-01-22 19:56:33 +08:00

60 lines
1.7 KiB
Groovy

plugins {
id 'com.android.application'
}
android {
namespace 'cn.hugh.bz.gk2'
compileSdk 34
defaultConfig {
applicationId "cn.hugh.bz.gk2"
minSdk 24
targetSdk 31
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
configurations.all {
resolutionStrategy {
// 强制使用统一的 Kotlin 版本,避免依赖冲突
force 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22'
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion '1.8.22'
}
}
// 排除已废弃的 kotlin-stdlib-jdk7 和 kotlin-stdlib-jdk8
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
// Glide for image loading
implementation 'com.github.bumptech.glide:glide:4.16.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
// JSON parsing
implementation 'com.google.code.gson:gson:2.10.1'
// Permissions
implementation 'androidx.core:core:1.12.0'
}