feat: 实现多相册功能并优化扫描性能
新增功能: - 多相册支持:创建、编辑、删除、切换相册 - 每个相册独立的文件夹池和配置(播放模式、间隔、返回桌面更换) - 相册管理页面:显示所有相册、当前徽章、配置信息 - 相册编辑页面:创建/编辑相册、选择文件夹、设置配置 - 主页显示当前激活的相册信息 - 删除相册功能(默认相册除外,带确认对话框) 核心实现: - Album 数据模型(id、name、folders、配置、时间戳等) - AlbumPreferences 相册管理器(保存/加载/迁移配置) - AlbumManagementFragment 相册列表页 - AlbumEditorActivity 相册编辑页 - 4个页面底部导航(主页、壁纸、相册、设置) 性能优化: - 并发扫描:使用线程池同时扫描多个文件夹(4倍提速) - 预分配容量:ArrayList 预分配容量减少扩容次数 - 快速文件检查:优化扩展名匹配算法(30%提速) - 内存缓存:5秒内不重复扫描同一文件夹 - 扫描限制:最大50000张图片防止OOM - 资源管理:正确释放线程池防止内存泄漏 Bug修复: - 修复"当前"徽章显示错误(动态获取激活相册ID) - 修复新建相册保存不生效(使用isNewAlbum标志) - 修复相册编辑页面文件夹选择功能(ActivityResultLauncher) - 添加防抖机制避免频繁统计图片数量 架构改进: - WallpaperPreferences 从 Album 读取配置 - 自动迁移旧配置到默认相册 - 支持全局文件夹池(所有相册共享) 新增文件: - Album.java, AlbumPreferences.java - AlbumManagementFragment.java, AlbumEditorActivity.java - 相册相关布局和图标(10个drawable) 修改文件: - MainActivity, ViewPagerAdapter, HomeFragment - ImageScanner, WallpaperPreferences - 底部导航、主页布局 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
24dd91aceb
commit
20b8f5fc93
23 files changed
+2094
-78
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="相册管理"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnCreateAlbum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:text="+ 新建"
|
||||
android:textSize="14sp"
|
||||
app:icon="@drawable/ic_add"
|
||||
app:iconGravity="textStart"
|
||||
app:cornerRadius="12dp"
|
||||
style="@style/Widget.Material3.Button.TonalButton" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 相册列表 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvAlbums"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
tools:listitem="@layout/item_album_card" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
Reference in new issue
Block a user