From 439d189b0012a108effa7b8aebeb2058c3e13059 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 1 Apr 2019 16:42:53 +0200 Subject: [PATCH] reset all remembered video positions on toggling the settings item --- .../com/simplemobiletools/gallery/pro/helpers/Config.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index f287b8308..3f0c9839e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -393,7 +393,14 @@ class Config(context: Context) : BaseConfig(context) { var rememberLastVideoPosition: Boolean get() = prefs.getBoolean(REMEMBER_LAST_VIDEO_POSITION, false) - set(rememberLastVideoPosition) = prefs.edit().putBoolean(REMEMBER_LAST_VIDEO_POSITION, rememberLastVideoPosition).apply() + set(rememberLastVideoPosition) { + if (!rememberLastVideoPosition) { + getAllLastVideoPositions().forEach { + prefs.edit().remove(it.key).apply() + } + } + prefs.edit().putBoolean(REMEMBER_LAST_VIDEO_POSITION, rememberLastVideoPosition).apply() + } var visibleBottomActions: Int get() = prefs.getInt(VISIBLE_BOTTOM_ACTIONS, DEFAULT_BOTTOM_ACTIONS)