feat: 添加壁纸历史记录功能
新增全局壁纸历史记录功能,记录所有使用过的壁纸,支持缩略图展示和系统相册打开。 核心功能: - 自动记录壁纸使用历史(最多保存50条) - 缩略图缓存(保持原图宽高比) - 2列网格布局展示 - 点击历史记录使用系统相册打开 - 支持删除单条记录和清空全部 新增文件: - WallpaperHistory.java - 历史记录数据模型 - WallpaperHistoryManager.java - 历史记录管理器 - WallpaperHistoryFragment.java - 历史页面 - fragment_wallpaper_history.xml - 页面布局 - item_history_card.xml - 卡片项布局 - ic_history.xml - 历史图标 修改文件: - AutoWallpaperService.java - 集成历史记录保存 - ViewPagerAdapter.java - 扩展为5个页面 - MainActivity.java - 更新页面切换范围 - bottom_nav_menu.xml - 添加历史标签 - strings.xml - 添加历史标签文本 - colors.xml - 添加图片占位符颜色 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
20b8f5fc93
commit
62215a9279
13 files changed
+830
-5
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9H1l3.89,3.89 0.07,0.14L9,12H6c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08V8H12z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- 标题栏 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:background="@color/surface">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="壁纸历史"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnClearHistory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:text="清空"
|
||||
android:textSize="14sp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="4dp"
|
||||
app:cornerRadius="8dp"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:textColor="@color/error"
|
||||
app:iconTint="@color/error"
|
||||
app:strokeColor="@color/error" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 历史记录列表 -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="8dp"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
<!-- 空状态提示 -->
|
||||
<TextView
|
||||
android:id="@+id/tvEmptyHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="暂无历史记录\n壁纸使用后会自动记录在这里"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/text_hint"
|
||||
android:gravity="center"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="6dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 缩略图 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivThumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@color/image_placeholder" />
|
||||
|
||||
<!-- 信息区域 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
|
||||
<!-- 相册名称 -->
|
||||
<TextView
|
||||
android:id="@+id/tvAlbumName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="相册名称"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:drawableStart="@drawable/ic_album"
|
||||
android:drawablePadding="4dp" />
|
||||
|
||||
<!-- 时间戳 -->
|
||||
<TextView
|
||||
android:id="@+id/tvTimestamp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="01-15 14:30"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/text_hint"
|
||||
android:layout_marginTop="4dp"
|
||||
android:drawableStart="@drawable/ic_schedule"
|
||||
android:drawablePadding="4dp" />
|
||||
|
||||
<!-- 删除按钮 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:text="删除"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="4dp"
|
||||
app:cornerRadius="6dp"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:textColor="@color/error"
|
||||
app:iconTint="@color/error"
|
||||
app:strokeColor="@color/error" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
@@ -18,9 +18,15 @@
|
||||
android:title="@string/nav_albums"
|
||||
android:orderInCategory="2" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_history"
|
||||
android:icon="@drawable/ic_history"
|
||||
android:title="@string/nav_history"
|
||||
android:orderInCategory="3" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="@string/nav_settings"
|
||||
android:orderInCategory="3" />
|
||||
android:orderInCategory="4" />
|
||||
</menu>
|
||||
@@ -31,6 +31,7 @@
|
||||
<!-- 卡片颜色 -->
|
||||
<color name="card_background">#FFFFFF</color>
|
||||
<color name="card_stroke">#E0E0E0</color>
|
||||
<color name="image_placeholder">#E0E0E0</color>
|
||||
|
||||
<!-- Launcher icon colors -->
|
||||
<color name="ic_launcher_background">#FF6200EE</color>
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
<string name="nav_home">主页</string>
|
||||
<string name="nav_wallpaper">壁纸</string>
|
||||
<string name="nav_albums">相册</string>
|
||||
<string name="nav_history">历史</string>
|
||||
<string name="nav_settings">设置</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user