diff options
author | ByteHamster <info@bytehamster.com> | 2019-05-28 18:11:12 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2019-05-28 18:11:12 +0200 |
commit | f05132a7163d50bd423d91c3e03f122ede6abbc8 (patch) | |
tree | 476fd1424dd33e2868f4bb847ed7838d9f7a957e /core/src/main | |
parent | 4443d629fc4592fdbe5a7b149e75f792c551588b (diff) | |
download | AntennaPod-f05132a7163d50bd423d91c3e03f122ede6abbc8.zip |
Allow to disable auto updates
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java | 7 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 1f01bb32b..118d434f8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -575,6 +575,13 @@ public class UserPreferences { restartUpdateAlarm(); } + public static void disableAutoUpdate() { + prefs.edit() + .putString(PREF_UPDATE_INTERVAL, "0") + .apply(); + AutoUpdateManager.disableAutoUpdate(); + } + /** * Change the auto-flattr settings * diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java index 96b83a995..e5aaa2db0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java @@ -60,6 +60,10 @@ public class AutoUpdateManager { WorkManager.getInstance().enqueueUniqueWork(WORK_ID_FEED_UPDATE, ExistingWorkPolicy.REPLACE, workRequest); } + public static void disableAutoUpdate() { + WorkManager.getInstance().cancelUniqueWork(WORK_ID_FEED_UPDATE); + } + private static Constraints getConstraints() { Constraints.Builder constraints = new Constraints.Builder(); |