diff --git a/src/de/danoeh/antennapod/service/download/HttpDownloader.java b/src/de/danoeh/antennapod/service/download/HttpDownloader.java index 14ca0000f..a12cf3e48 100644 --- a/src/de/danoeh/antennapod/service/download/HttpDownloader.java +++ b/src/de/danoeh/antennapod/service/download/HttpDownloader.java @@ -57,9 +57,10 @@ public class HttpDownloader extends Downloader { status.setSize(connection.getContentLength()); if (AppConfig.DEBUG) Log.d(TAG, "Size is " + status.getSize()); - if (status.getSize() == -1 - || status.getSize() <= StorageUtils - .getFreeSpaceAvailable()) { + long freeSpace = StorageUtils.getFreeSpaceAvailable(); + if (AppConfig.DEBUG) + Log.d(TAG, "Free space is " + freeSpace); + if (status.getSize() == -1 || status.getSize() <= freeSpace) { if (AppConfig.DEBUG) Log.d(TAG, "Size is " + status.getSize()); publishProgress(); diff --git a/src/de/danoeh/antennapod/util/StorageUtils.java b/src/de/danoeh/antennapod/util/StorageUtils.java index eb3b5d3a4..db61ff356 100644 --- a/src/de/danoeh/antennapod/util/StorageUtils.java +++ b/src/de/danoeh/antennapod/util/StorageUtils.java @@ -28,9 +28,11 @@ public class StorageUtils { } /** Get the number of free bytes that are available on the external storage. */ - public static int getFreeSpaceAvailable() { + public static long getFreeSpaceAvailable() { StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); - return stat.getAvailableBlocks() * stat.getBlockSize(); + long availableBlocks = stat.getAvailableBlocks(); + long blockSize = stat.getBlockSize(); + return availableBlocks * blockSize; } public static boolean externalStorageMounted() {