diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-11-30 18:27:24 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-01-07 23:16:01 +0100 |
commit | 99800d98731ed2ef415932abebe1a66955df4f2e (patch) | |
tree | 3d9eef6d7430d3b5bdbdbe0cc1272674bf87e8b4 | |
parent | 810b2c2df59d60e4bc5097b6406cc4a6d5a6d3a7 (diff) | |
download | AntennaPod-99800d98731ed2ef415932abebe1a66955df4f2e.zip |
Change parameters of StorageUtils.storageAvailable
3 files changed, 5 insertions, 8 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java index 7f975b3c8..b02e82f0b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java @@ -39,7 +39,7 @@ public class StorageErrorActivity extends ActionBarActivity { @Override protected void onResume() { super.onResume(); - if (StorageUtils.storageAvailable(this)) { + if (StorageUtils.storageAvailable()) { leaveErrorState(); } else { registerReceiver(mediaUpdate, new IntentFilter( diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java index 25ab2f6fd..0b9fba6f7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java @@ -161,7 +161,7 @@ public class HttpDownloader extends Downloader { return; } - if (!StorageUtils.storageAvailable(ClientConfig.applicationCallbacks.getApplicationInstance())) { + if (!StorageUtils.storageAvailable()) { onFail(DownloadError.ERROR_DEVICE_NOT_FOUND, null); return; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java index d64148715..1ef81bf64 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java @@ -1,14 +1,12 @@ package de.danoeh.antennapod.core.util; import android.app.Activity; -import android.content.Context; import android.os.Build; import android.os.StatFs; import android.util.Log; import java.io.File; -import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -18,13 +16,12 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; public class StorageUtils { private static final String TAG = "StorageUtils"; - public static boolean storageAvailable(Context context) { + public static boolean storageAvailable() { File dir = UserPreferences.getDataFolder(null); if (dir != null) { return dir.exists() && dir.canRead() && dir.canWrite(); } else { - if (BuildConfig.DEBUG) - Log.d(TAG, "Storage not available: data folder is null"); + Log.d(TAG, "Storage not available: data folder is null"); return false; } } @@ -39,7 +36,7 @@ public class StorageUtils { * @return true if external storage is available */ public static boolean checkStorageAvailability(Activity activity) { - boolean storageAvailable = storageAvailable(activity); + boolean storageAvailable = storageAvailable(); if (!storageAvailable) { activity.finish(); activity.startActivity(ClientConfig.applicationCallbacks.getStorageErrorActivity(activity)); |