From fe6b9ca02938dd5fdcbe386ef57b0a7aa299d6df Mon Sep 17 00:00:00 2001 From: hugh <1012760428@qq.com> Date: Sat, 31 Jan 2026 23:03:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=A3=81=E7=BA=B8=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BB=85=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E6=94=B6=E8=97=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除固定壁纸停止自动更新的检查逻辑 - 固定壁纸只是保存用户喜欢的壁纸 URL - app 的启用/禁用使用独立的 isEnabled 标志控制 - 四指点击:在相册中打开固定壁纸并设置 app 为禁用 - 四指点击检查的是 isEnabled 而不是 isFixedWallpaperEnabled Co-Authored-By: Claude Sonnet 4.5 --- .../gk2/wallpaper/AutoWallpaperService.java | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/cn/hugh/bz/gk2/wallpaper/AutoWallpaperService.java b/app/src/main/java/cn/hugh/bz/gk2/wallpaper/AutoWallpaperService.java index da8b6c2..d9c3c47 100644 --- a/app/src/main/java/cn/hugh/bz/gk2/wallpaper/AutoWallpaperService.java +++ b/app/src/main/java/cn/hugh/bz/gk2/wallpaper/AutoWallpaperService.java @@ -358,35 +358,6 @@ public class AutoWallpaperService extends WallpaperService { // Load current wallpaper config AppConfig config = prefs.loadConfig(); - // 检查是否启用了固定壁纸 - if (config.isFixedWallpaperEnabled() && config.getFixedWallpaperUri() != null) { - String fixedUri = config.getFixedWallpaperUri(); - fileLogger.log(TAG, "Fixed wallpaper enabled: " + fixedUri); - - // 停止视频播放 - stopVideo(); - - // 加载固定壁纸(仅支持图片) - // 从 URI 中提取文件名作为显示名称 - String displayName = "Fixed Wallpaper"; - if (fixedUri.contains("/")) { - String[] parts = fixedUri.split("/"); - displayName = parts[parts.length - 1]; - } - - WallpaperMedia fixedMedia = new WallpaperMedia( - fixedUri, - null, // folderPath - displayName, - System.currentTimeMillis(), // lastModified - 0, // fileSize - MediaType.IMAGE - ); - fileLogger.log(TAG, "Displaying fixed wallpaper: " + fixedUri); - loadAndDrawImageAsync(holder, fixedMedia, config, false); - return; - } - if (!config.isEnabled() || !hasAvailableMedia(config)) { Log.w(TAG, "Wallpaper not enabled or no media. Enabled: " + config.isEnabled() + ", HasMedia: " + hasAvailableMedia(config)); // 直接绘制占位符(不需要后台线程) @@ -990,8 +961,8 @@ public class AutoWallpaperService extends WallpaperService { // 获取当前配置 AppConfig config = prefs.loadConfig(); - // 检查当前是否是禁用状态 - if (config.isFixedWallpaperEnabled()) { + // 检查 app 是否已经禁用 + if (!config.isEnabled()) { // app 已经是禁用状态,什么都不做 fileLogger.log(TAG, "App already disabled, ignoring four-finger tap"); return; @@ -1014,12 +985,12 @@ public class AutoWallpaperService extends WallpaperService { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); - // 打开相册后,将 app 状态改为禁用 - config.setFixedWallpaperEnabled(true); + // 打开相册后,将 app 设置为禁用 + config.setEnabled(false); prefs.saveConfig(config); - fileLogger.log(TAG, "Opened gallery for fixed wallpaper, app disabled"); - android.widget.Toast.makeText(AutoWallpaperService.this, "已在相册中打开固定壁纸,请在相册中设置为壁纸", android.widget.Toast.LENGTH_LONG).show(); + fileLogger.log(TAG, "Opened gallery, app disabled"); + android.widget.Toast.makeText(AutoWallpaperService.this, "已在相册中打开固定壁纸,自动更新已禁用", android.widget.Toast.LENGTH_LONG).show(); } catch (Exception e) { Log.e(TAG, "Failed to open gallery", e); fileLogger.error(TAG, "Failed to open gallery: " + e.getMessage(), e);