diff --git a/app/src/main/java/ru/vtosters/lite/downloaders/StoryDownloader.java b/app/src/main/java/ru/vtosters/lite/downloaders/StoryDownloader.java index 31003a267..a764711f3 100644 --- a/app/src/main/java/ru/vtosters/lite/downloaders/StoryDownloader.java +++ b/app/src/main/java/ru/vtosters/lite/downloaders/StoryDownloader.java @@ -2,6 +2,7 @@ package ru.vtosters.lite.downloaders; import static ru.vtosters.lite.downloaders.VideoDownloader.downloadVideo; import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext; +import static ru.vtosters.lite.utils.Preferences.getPhotosDir; import android.app.DownloadManager; import android.content.Context; @@ -23,7 +24,7 @@ public class StoryDownloader { DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setTitle("photo" + story.E.a); - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DCIM, "/Stories/photo" + story.E.a + ".jpg"); + request.setDestinationInExternalPublicDir(getPhotosDir().getAbsolutePath(), "/Stories/photo" + story.E.a + ".jpg"); ((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request); return; } diff --git a/app/src/main/java/ru/vtosters/lite/downloaders/VideoDownloader.java b/app/src/main/java/ru/vtosters/lite/downloaders/VideoDownloader.java index f486cfdaa..cdc73286e 100644 --- a/app/src/main/java/ru/vtosters/lite/downloaders/VideoDownloader.java +++ b/app/src/main/java/ru/vtosters/lite/downloaders/VideoDownloader.java @@ -5,6 +5,7 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken; import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext; import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier; import static ru.vtosters.lite.utils.AndroidUtils.getString; +import static ru.vtosters.lite.utils.Preferences.getVideosDir; import android.app.AlertDialog; import android.app.DownloadManager; @@ -104,7 +105,7 @@ public class VideoDownloader { DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setTitle(videoFile.toString()); - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4"); + request.setDestinationInExternalPublicDir(getVideosDir().getAbsolutePath(), videoFile + ".mp4"); ((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request); return; } @@ -115,7 +116,7 @@ public class VideoDownloader { DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setTitle(videoFile.toString()); - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4"); + request.setDestinationInExternalPublicDir(getVideosDir().getAbsolutePath(), videoFile + ".mp4"); ((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request); })); builder.show();