diff --git a/app/src/main/java/de/danoeh/antennapod/actionbutton/DownloadActionButton.java b/app/src/main/java/de/danoeh/antennapod/actionbutton/DownloadActionButton.java
index 15f07d207..4a3545f21 100644
--- a/app/src/main/java/de/danoeh/antennapod/actionbutton/DownloadActionButton.java
+++ b/app/src/main/java/de/danoeh/antennapod/actionbutton/DownloadActionButton.java
@@ -2,6 +2,7 @@ package de.danoeh.antennapod.actionbutton;
import android.content.Context;
import android.view.View;
+import android.widget.Toast;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
@@ -16,6 +17,12 @@ import de.danoeh.antennapod.storage.preferences.UsageStatistics;
import de.danoeh.antennapod.net.common.NetworkUtils;
public class DownloadActionButton extends ItemActionButton {
+ private static final int TIMEOUT_NETWORK_WARN_SECONDS = 300;
+ private static final int BYPASS_TYPE_NOW = 1;
+ private static final int BYPASS_TYPE_LATER = 2;
+
+ private static int bypassCellularNetworkType = 0;
+ private static long bypassCellularNetworkWarningTimer = 0;
public DownloadActionButton(FeedItem item) {
super(item);
@@ -47,15 +54,29 @@ public class DownloadActionButton extends ItemActionButton {
UsageStatistics.logAction(UsageStatistics.ACTION_DOWNLOAD);
- if (NetworkUtils.isEpisodeDownloadAllowed()) {
- DownloadServiceInterface.get().downloadNow(context, item, false);
+ long timeSinceBypass = System.currentTimeMillis() / 1000 - bypassCellularNetworkWarningTimer;
+ boolean shouldBypass = timeSinceBypass < TIMEOUT_NETWORK_WARN_SECONDS;
+ if (shouldBypass && bypassCellularNetworkType == BYPASS_TYPE_NOW) {
+ Toast.makeText(context, context.getString(
+ R.string.mobile_download_notice, TIMEOUT_NETWORK_WARN_SECONDS / 60), Toast.LENGTH_LONG).show();
+ }
+ if (NetworkUtils.isEpisodeDownloadAllowed() || shouldBypass) {
+ DownloadServiceInterface.get().downloadNow(context, item, bypassCellularNetworkType == BYPASS_TYPE_NOW);
} else {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context)
.setTitle(R.string.confirm_mobile_download_dialog_title)
.setPositiveButton(R.string.confirm_mobile_download_dialog_download_later,
- (d, w) -> DownloadServiceInterface.get().downloadNow(context, item, false))
+ (d, w) -> {
+ bypassCellularNetworkType = BYPASS_TYPE_LATER;
+ bypassCellularNetworkWarningTimer = System.currentTimeMillis() / 1000;
+ DownloadServiceInterface.get().downloadNow(context, item, false);
+ })
.setNeutralButton(R.string.confirm_mobile_download_dialog_allow_this_time,
- (d, w) -> DownloadServiceInterface.get().downloadNow(context, item, true))
+ (d, w) -> {
+ bypassCellularNetworkType = BYPASS_TYPE_NOW;
+ bypassCellularNetworkWarningTimer = System.currentTimeMillis() / 1000;
+ DownloadServiceInterface.get().downloadNow(context, item, true);
+ })
.setNegativeButton(R.string.cancel_label, null);
if (NetworkUtils.isNetworkRestricted() && NetworkUtils.isVpnOverWifi()) {
builder.setMessage(R.string.confirm_mobile_download_dialog_message_vpn);
diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml
index 1aa93c312..924421df8 100644
--- a/ui/i18n/src/main/res/values/strings.xml
+++ b/ui/i18n/src/main/res/values/strings.xml
@@ -325,6 +325,7 @@
Your VPN app pretends to be a mobile network (metered connection). Downloading over mobile data connection is disabled in the settings. If you want this problem to be fixed, contact the creators of your VPN app.
Download later
Download anyway
+ Downloading over mobile data connection for the next %d minutes
Confirm mobile streaming
Streaming over mobile data connection is disabled in the settings. Tap to stream anyway.
Always