mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +01:00
Make sure Diaspora image folder exists before sharing/downloading images
This commit is contained in:
parent
392b76c53d
commit
9f39e3ca1c
1 changed files with 14 additions and 2 deletions
|
@ -108,11 +108,17 @@ public class ContextMenuWebView extends NestedWebView {
|
|||
}
|
||||
}
|
||||
if (writeToStoragePermitted) {
|
||||
//Make sure, Diaspora Folder exists
|
||||
File destinationFolder = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora");
|
||||
if(!destinationFolder.exists()) {
|
||||
destinationFolder.mkdirs();
|
||||
}
|
||||
|
||||
if (url != null) {
|
||||
Uri source = Uri.parse(url);
|
||||
DownloadManager.Request request = new DownloadManager.Request(source);
|
||||
File destinationFile = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"
|
||||
+ System.currentTimeMillis() + ".png");
|
||||
File destinationFile = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"+ System.currentTimeMillis() + ".png");
|
||||
|
||||
request.setDestinationUri(Uri.fromFile(destinationFile));
|
||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
|
||||
|
@ -150,6 +156,12 @@ public class ContextMenuWebView extends NestedWebView {
|
|||
}
|
||||
}
|
||||
if (writeToStoragePermitted) {
|
||||
//Make sure, Diaspora Folder exists
|
||||
File destinationFolder = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora");
|
||||
if(!destinationFolder.exists()) {
|
||||
destinationFolder.mkdirs();
|
||||
}
|
||||
|
||||
final Uri local = Uri.parse(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png");
|
||||
new ImageDownloadTask(null, local.getPath()) {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue