feat: 确保双击配置的持久化正确工作
- 在 WallpaperPreferences 中添加 KEY_DOUBLE_TAP_ENABLED 常量 - 在 loadConfig 方法中加载双击配置(默认值为 true) - 在 saveConfig 方法中保存双击配置到 SharedPreferences - 确保配置在应用重启后能正确恢复 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ebdb85fa0e
commit
37eb2fda7c
1 file changed
+8
@@ -20,6 +20,7 @@ public class WallpaperPreferences {
|
||||
private static final String KEY_VIDEO_ENABLED = "video_enabled";
|
||||
private static final String KEY_VIDEO_MUTED = "video_muted";
|
||||
private static final String KEY_VIDEO_PAUSE_ON_BATTERY = "video_pause_on_battery";
|
||||
private static final String KEY_DOUBLE_TAP_ENABLED = "double_tap_enabled";
|
||||
|
||||
private final SharedPreferences prefs;
|
||||
private final Gson gson;
|
||||
@@ -121,6 +122,9 @@ public class WallpaperPreferences {
|
||||
config.setVideoMuted(prefs.getBoolean(KEY_VIDEO_MUTED, true));
|
||||
config.setVideoPauseOnBattery(prefs.getBoolean(KEY_VIDEO_PAUSE_ON_BATTERY, true));
|
||||
|
||||
// Global double tap setting from SharedPreferences
|
||||
config.setDoubleTapEnabled(prefs.getBoolean(KEY_DOUBLE_TAP_ENABLED, true));
|
||||
|
||||
// 添加日志:记录从相册加载的图片和视频数量
|
||||
android.util.Log.i("WallpaperPreferences", "loadConfig: album=" + album.getName() +
|
||||
", folders=" + album.getFolders().size() +
|
||||
@@ -143,6 +147,9 @@ public class WallpaperPreferences {
|
||||
config.setVideoMuted(true);
|
||||
config.setVideoPauseOnBattery(true);
|
||||
|
||||
// Default double tap setting
|
||||
config.setDoubleTapEnabled(true);
|
||||
|
||||
android.util.Log.w("WallpaperPreferences", "loadConfig: No active album found");
|
||||
}
|
||||
|
||||
@@ -186,6 +193,7 @@ public class WallpaperPreferences {
|
||||
.putBoolean(KEY_VIDEO_ENABLED, config.isVideoEnabled())
|
||||
.putBoolean(KEY_VIDEO_MUTED, config.isVideoMuted())
|
||||
.putBoolean(KEY_VIDEO_PAUSE_ON_BATTERY, config.isVideoPauseOnBattery())
|
||||
.putBoolean(KEY_DOUBLE_TAP_ENABLED, config.isDoubleTapEnabled())
|
||||
.apply();
|
||||
}
|
||||
public void saveLastUri(String uri) {
|
||||
|
||||
Reference in new issue
Block a user