Moved isExternalStorageWritable()
into FileUtils
.
This commit is contained in:
parent
3c19a994d7
commit
4b49c3e43b
2 changed files with 8 additions and 6 deletions
|
@ -64,6 +64,7 @@ import de.luhmer.owncloudnewsreader.async_tasks.RssItemToHtmlTask;
|
|||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
import de.luhmer.owncloudnewsreader.helper.AsyncTaskHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.ColorHelper;
|
||||
import de.luhmer.owncloudnewsreader.helper.FileUtils;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
|
||||
public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Listener {
|
||||
|
@ -360,7 +361,7 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
}
|
||||
|
||||
private void downloadImage(URL url) {
|
||||
if(isExternalStorageWritable()) {
|
||||
if(FileUtils.isExternalStorageWritable()) {
|
||||
String filename = url.getFile().substring(url.getFile().lastIndexOf('/') + 1, url.getFile().length());
|
||||
dlManager = (DownloadManager) getActivity().getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url.toString()));
|
||||
|
@ -416,11 +417,6 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
|
|||
getActivity().registerReceiver(downloadCompleteReceiver, intentFilter);
|
||||
}
|
||||
|
||||
public boolean isExternalStorageWritable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true when the last page on the webview's history stack is
|
||||
* the original rss item page
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package de.luhmer.owncloudnewsreader.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.nostra13.universalimageloader.utils.StorageUtils;
|
||||
|
||||
|
@ -87,4 +88,9 @@ public class FileUtils {
|
|||
{
|
||||
return getPath(context) + "/podcasts";
|
||||
}
|
||||
|
||||
public static boolean isExternalStorageWritable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue