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);