diff options
Diffstat (limited to 'core')
3 files changed, 18 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 48492ced9..20a349055 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 @@ -84,6 +84,7 @@ public class UserPreferences { public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl"; public static final String PREF_ENABLE_AUTODL_ON_BATTERY = "prefEnableAutoDownloadOnBattery"; public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter"; + public static final String PREF_ENABLE_AUTODL_ON_MOBILE = "prefEnableAutoDownloadOnMobile"; public static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks"; public static final String PREF_PROXY_TYPE = "prefProxyType"; public static final String PREF_PROXY_HOST = "prefProxyHost"; @@ -401,6 +402,11 @@ public class UserPreferences { return prefs.getBoolean(PREF_ENABLE_AUTODL_WIFI_FILTER, false); } + public static boolean isEnableAutodownloadOnMobile() { + return prefs.getBoolean(PREF_ENABLE_AUTODL_ON_MOBILE, false); + } + + public static int getImageCacheSize() { String cacheSizeString = prefs.getString(PREF_IMAGE_CACHE_SIZE, IMAGE_CACHE_DEFAULT_VALUE); int cacheSizeInt = Integer.parseInt(cacheSizeString); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java index 1717bde0e..c73d6f6e3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java @@ -66,6 +66,16 @@ public class NetworkUtils { } } } + } else { + if (!UserPreferences.isEnableAutodownloadOnMobile()) { + Log.d(TAG, "Auto Download not enabled on Mobile"); + return false; + } + if (networkInfo.isRoaming()) { + Log.d(TAG, "Roaming on foreign network"); + return false; + } + return true; } } Log.d(TAG, "Network for auto-dl is not available"); diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 38c891d99..7648f8867 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -365,6 +365,8 @@ <string name="pref_automatic_download_sum">Configure the automatic download of episodes.</string> <string name="pref_autodl_wifi_filter_title">Enable Wi-Fi filter</string> <string name="pref_autodl_wifi_filter_sum">Allow automatic download only for selected Wi-Fi networks.</string> + <string name="pref_autodl_allow_on_mobile_title">Download on mobile connection</string> + <string name="pref_autodl_allow_on_mobile_sum">Allow automatic download over the mobile data connection.</string> <string name="pref_automatic_download_on_battery_title">Download when not charging</string> <string name="pref_automatic_download_on_battery_sum">Allow automatic download when the battery is not charging</string> <string name="pref_parallel_downloads_title">Parallel Downloads</string> |