Add auto download on mobile connection option
This commit is contained in:
parent
f20a656e62
commit
7060e56a69
|
@ -218,6 +218,11 @@
|
|||
android:title="@string/pref_automatic_download_on_battery_title"
|
||||
android:summary="@string/pref_automatic_download_on_battery_sum"
|
||||
android:defaultValue="true"/>
|
||||
<de.danoeh.antennapod.preferences.SwitchCompatPreference
|
||||
android:key="prefEnableAutoDownloadOnMobile"
|
||||
android:title="@string/pref_autodl_allow_on_mobile_title"
|
||||
android:summary="@string/pref_autodl_allow_on_mobile_sum"
|
||||
android:defaultValue="false"/>
|
||||
<de.danoeh.antennapod.preferences.SwitchCompatPreference
|
||||
android:key="prefEnableAutoDownloadWifiFilter"
|
||||
android:title="@string/pref_autodl_wifi_filter_title"
|
||||
|
|
|
@ -83,6 +83,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";
|
||||
|
@ -396,6 +397,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);
|
||||
|
|
|
@ -66,6 +66,18 @@ 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");
|
||||
|
|
|
@ -363,6 +363,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>
|
||||
|
|
Loading…
Reference in New Issue