fix: 修复固定壁纸功能和更新提示文案
- 在 loadFixedWallpaperSettings() 中添加调用 setupFixedWallpaperListeners() - 修复 updateFixedWallpaperPreview() 的条件判断,只检查 fixedUri - 更新所有提示文案,说明正确的使用流程 1. 选择固定壁纸后,app 继续自动更新 2. 四指点击桌面将固定壁纸设置为系统壁纸并禁用自动更新 3. 点击清除按钮可恢复自动更新 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b11fe127e
commit
de3a36240b
2 files changed
+90
-3
No files matched your search
@@ -345,7 +345,7 @@ public class SettingsFragment extends Fragment {
|
||||
btnClearFixedWallpaper.setOnClickListener(v -> {
|
||||
new androidx.appcompat.app.AlertDialog.Builder(requireContext())
|
||||
.setTitle("清除固定壁纸")
|
||||
.setMessage("确定要清除固定壁纸并恢复自动更新吗?")
|
||||
.setMessage("确定要清除固定壁纸吗?清除后自动更新功能将恢复。")
|
||||
.setPositiveButton("确定", (dialog, which) -> clearFixedWallpaper())
|
||||
.setNegativeButton("取消", null)
|
||||
.show();
|
||||
@@ -374,13 +374,14 @@ public class SettingsFragment extends Fragment {
|
||||
updateFixedWallpaperPreview();
|
||||
refreshWallpaperService();
|
||||
|
||||
Toast.makeText(requireContext(), "已恢复自动更新", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), "已清除固定壁纸,自动更新已恢复", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载固定壁纸设置
|
||||
*/
|
||||
private void loadFixedWallpaperSettings() {
|
||||
setupFixedWallpaperListeners();
|
||||
updateFixedWallpaperPreview();
|
||||
}
|
||||
|
||||
@@ -391,7 +392,7 @@ public class SettingsFragment extends Fragment {
|
||||
AppConfig config = wallpaperPrefs.loadConfig();
|
||||
String fixedUri = config.getFixedWallpaperUri();
|
||||
|
||||
if (fixedUri != null && config.isFixedWallpaperEnabled()) {
|
||||
if (fixedUri != null) {
|
||||
// 使用 Glide 加载缩略图
|
||||
Glide.with(this)
|
||||
.load(fixedUri)
|
||||
|
||||
@@ -268,6 +268,92 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<!-- 固定壁纸设置卡片 -->
|
||||
<TextView
|
||||
android:id="@+id/tvFixedWallpaperLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_lg"
|
||||
android:text="固定壁纸"
|
||||
android:textSize="@dimen/text_size_xxl"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_primary"
|
||||
app:layout_constraintTop_toBottomOf="@id/cardDoubleTapSettings"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/cardFixedWallpaper"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_sm"
|
||||
app:cardElevation="@dimen/card_elevation"
|
||||
app:cardCornerRadius="@dimen/corner_radius_md"
|
||||
app:cardBackgroundColor="@color/bg_card"
|
||||
app:strokeColor="@color/glass_border"
|
||||
app:strokeWidth="@dimen/glass_border_width"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvFixedWallpaperLabel"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/card_padding">
|
||||
|
||||
<!-- 选择固定壁纸按钮 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnSelectFixedWallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="选择固定壁纸"
|
||||
android:textSize="@dimen/text_size_md"
|
||||
app:icon="@drawable/ic_image"
|
||||
app:iconGravity="textStart"
|
||||
app:cornerRadius="@dimen/corner_radius_sm"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton" />
|
||||
|
||||
<!-- 固定壁纸预览 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivFixedWallpaperPreview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="@dimen/spacing_md"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="固定壁纸预览"
|
||||
android:background="@color/bg_secondary" />
|
||||
|
||||
<!-- 清除固定壁纸按钮 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnClearFixedWallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="清除固定壁纸"
|
||||
android:textSize="@dimen/text_size_sm"
|
||||
android:layout_marginTop="@dimen/spacing_md"
|
||||
app:icon="@drawable/ic_delete"
|
||||
app:iconGravity="textStart"
|
||||
app:cornerRadius="@dimen/corner_radius_sm"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:textColor="@color/color_error"
|
||||
app:iconTint="@color/color_error"
|
||||
app:strokeColor="@color/color_error"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_md"
|
||||
android:text="提示:选择固定壁纸后,请四指点击桌面将其设置为系统壁纸并禁用自动更新。点击清除按钮可恢复自动更新。"
|
||||
android:textSize="@dimen/text_size_sm"
|
||||
android:textColor="@color/text_hint"
|
||||
android:lineSpacingExtra="4dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
Reference in new issue
Block a user