feat: 添加返回桌面更换壁纸配置开关

允许用户控制是否在返回桌面时自动更换壁纸,默认开启以提供更好的用户体验。

新增功能:
- 添加 changeOnReturnToHome 配置项(默认开启)
- 设置界面新增开关控件,支持用户自定义
- 优化壁纸服务逻辑,根据配置决定是否更换壁纸
- 关闭状态下复用当前壁纸,减少性能消耗

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuangandClaude Sonnet 4.5 committed 2026-01-22 20:14:06 +08:00
1 parent d304297f2c
commit a5797b08a8
6 files changed
+87 -8

No files matched your search

+39 -1
View File
@@ -91,13 +91,51 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/tvChangeOnReturnLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/setting_change_on_return_title"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="24dp"
app:layout_constraintTop_toBottomOf="@id/tvIntervalValue"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/tvChangeOnReturnDesc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/setting_change_on_return_desc"
android:textSize="14sp"
android:textColor="@android:color/darker_gray"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="4dp"
app:layout_constraintTop_toBottomOf="@id/tvChangeOnReturnLabel"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Switch
android:id="@+id/switchChangeOnReturn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:checked="true"
app:layout_constraintTop_toBottomOf="@id/tvChangeOnReturnDesc"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:id="@+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="保存"
android:layout_marginTop="24dp"
app:layout_constraintTop_toBottomOf="@id/tvIntervalValue"
app:layout_constraintTop_toBottomOf="@id/switchChangeOnReturn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
+4
View File
@@ -11,4 +11,8 @@
<string name="status_disabled">已停止</string>
<string name="next_change">下次更换:%d 分钟</string>
<string name="no_folders">未选择文件夹</string>
<!-- 返回桌面更换壁纸 -->
<string name="setting_change_on_return_title">返回桌面更换壁纸</string>
<string name="setting_change_on_return_desc">每次返回桌面或解锁时自动更换到下一张壁纸</string>
</resources>