diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-05-03 21:19:20 +0200 |
---|---|---|
committer | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-05-03 21:19:20 +0200 |
commit | a766977e6dcb60a537922118185f723ef3e873c6 (patch) | |
tree | 6e50aa9ce1e429dfa38cfa3b1ec299f50890770a /core | |
parent | fd7cdd3c715565b621cb7ba2f485dd1bad696044 (diff) | |
download | AntennaPod-a766977e6dcb60a537922118185f723ef3e873c6.zip |
Check if items are already in the queue
Diffstat (limited to 'core')
3 files changed, 7 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java index d1ff5d232..d37f97a5f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/FeedUpdateReceiver.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.Intent; import android.util.Log; -import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.NetworkUtils; @@ -19,8 +18,7 @@ public class FeedUpdateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Received intent"); - boolean mobileUpdate = UserPreferences.isAllowMobileUpdate(); - if (mobileUpdate || NetworkUtils.connectedToWifi(context)) { + if (NetworkUtils.isDownloadAllowed(context)) { DBTasks.refreshExpiredFeeds(context); } else { Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed"); 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 58011827c..3a349e221 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 @@ -68,6 +68,10 @@ public class NetworkUtils { return info != null && info.isConnected(); } + public static boolean isDownloadAllowed(Context context) { + return UserPreferences.isAllowMobileUpdate() || NetworkUtils.connectedToWifi(context); + } + public static boolean connectedToWifi(Context context) { ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index a7d4669fe..93deefd49 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -147,7 +147,8 @@ <string name="authentication_notification_title">Authentication required</string> <string name="authentication_notification_msg">The resource you requested requires a username and a password</string> <string name="confirm_mobile_download_dialog_title">Confirm Mobile Download</string> - <string name="confirm_mobile_download_dialog_message">Downloading over mobile data connection disable in settings.\n\nEnable temporarily or just add to queue?\n\n<small>Your choice will be remember for 10 minutes.</small></string> + <string name="confirm_mobile_download_dialog_message_not_in_queue">Downloading over mobile data connection disable in settings.\n\nEnable temporarily or just add to queue?\n\n<small>Your choice will be remember for 10 minutes.</small></string> + <string name="confirm_mobile_download_dialog_message">Downloading over mobile data connection disable in settings.\n\nEnable temporarily?\n\n<small>Your choice will be remember for 10 minutes.</small></string> <string name="confirm_mobile_download_dialog_only_add_to_queue">Only add to Queue</string> <string name="confirm_mobile_download_dialog_enable_temporarily">Enable temporarily</string> |