summaryrefslogtreecommitdiff
path: root/src/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/de')
-rw-r--r--src/de/danoeh/antennapod/activity/PreferenceActivity.java14
-rw-r--r--src/de/danoeh/antennapod/feed/FeedManager.java3
-rw-r--r--src/de/danoeh/antennapod/preferences/UserPreferences.java10
3 files changed, 26 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/activity/PreferenceActivity.java b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
index 8b3f2539a..b7e000785 100644
--- a/src/de/danoeh/antennapod/activity/PreferenceActivity.java
+++ b/src/de/danoeh/antennapod/activity/PreferenceActivity.java
@@ -157,6 +157,15 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
return true;
}
});
+ findPreference(UserPreferences.PREF_ENABLE_AUTODL).setOnPreferenceClickListener(new OnPreferenceClickListener() {
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ checkItemVisibility();
+ return true;
+ }
+ });
+
buildAutodownloadSelectedNetworsPreference();
setSelectedNetworksEnabled(UserPreferences
.isEnableAutodownloadWifiFilter());
@@ -187,6 +196,11 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken);
findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken);
+ findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
+ .setEnabled(UserPreferences.isEnableAutodownload());
+ setSelectedNetworksEnabled(UserPreferences.isEnableAutodownload()
+ && UserPreferences.isEnableAutodownloadWifiFilter());
+
}
private void setEpisodeCacheSizeText(int cacheSize) {
diff --git a/src/de/danoeh/antennapod/feed/FeedManager.java b/src/de/danoeh/antennapod/feed/FeedManager.java
index 1322fd54a..2d552514e 100644
--- a/src/de/danoeh/antennapod/feed/FeedManager.java
+++ b/src/de/danoeh/antennapod/feed/FeedManager.java
@@ -629,7 +629,8 @@ public class FeedManager {
public void autodownloadUndownloadedItems(Context context) {
if (AppConfig.DEBUG)
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
- if (NetworkUtils.autodownloadNetworkAvailable(context)) {
+ if (NetworkUtils.autodownloadNetworkAvailable(context)
+ && UserPreferences.isEnableAutodownload()) {
int undownloadedEpisodes = getNumberOfUndownloadedEpisodes();
int downloadedEpisodes = getNumberOfDownloadedEpisodes();
int deletedEpisodes = performAutoCleanup(context,
diff --git a/src/de/danoeh/antennapod/preferences/UserPreferences.java b/src/de/danoeh/antennapod/preferences/UserPreferences.java
index 489f9f02d..0239c72d4 100644
--- a/src/de/danoeh/antennapod/preferences/UserPreferences.java
+++ b/src/de/danoeh/antennapod/preferences/UserPreferences.java
@@ -37,6 +37,7 @@ public class UserPreferences implements
public static final String PREF_AUTO_DELETE = "prefAutoDelete";
public static final String PREF_THEME = "prefTheme";
public static final String PREF_DATA_FOLDER = "prefDataFolder";
+ public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl";
public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter";
private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks";
public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize";
@@ -53,6 +54,7 @@ public class UserPreferences implements
private boolean displayOnlyEpisodes;
private boolean autoDelete;
private int theme;
+ private boolean enableAutodownload;
private boolean enableAutodownloadWifiFilter;
private String[] autodownloadSelectedNetworks;
private int episodeCacheSize;
@@ -101,6 +103,7 @@ public class UserPreferences implements
sp.getString(PREF_AUTODL_SELECTED_NETWORKS, ""), ',');
episodeCacheSize = Integer.valueOf(sp.getString(
PREF_EPISODE_CACHE_SIZE, "20"));
+ enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
}
private int readThemeValue(String valueFromPrefs) {
@@ -181,6 +184,11 @@ public class UserPreferences implements
return instance.episodeCacheSize;
}
+ public static boolean isEnableAutodownload() {
+ instanceAvailable();
+ return instance.enableAutodownload;
+ }
+
@Override
public void onSharedPreferenceChanged(SharedPreferences sp, String key) {
if (AppConfig.DEBUG)
@@ -218,6 +226,8 @@ public class UserPreferences implements
} else if (key.equals(PREF_EPISODE_CACHE_SIZE)) {
episodeCacheSize = Integer.valueOf(sp.getString(
PREF_EPISODE_CACHE_SIZE, "20"));
+ } else if (key.equals(PREF_ENABLE_AUTODL)) {
+ enableAutodownload = sp.getBoolean(PREF_ENABLE_AUTODL, false);
}
}