From b9aca981e51bffedae6fae7f483af36f4768eb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 10 Sep 2021 16:56:52 +0200 Subject: [PATCH] [App] Change app-wide storage dir to Download subfolder. --- .../edziennik/ui/modules/views/AttachmentsView.kt | 4 +--- app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt index 354a8921..564fbf12 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/views/AttachmentsView.kt @@ -37,9 +37,7 @@ class AttachmentsView @JvmOverloads constructor( } private val storageDir by lazy { - val storageDir = Environment.getExternalStoragePublicDirectory("Szkolny.eu") - storageDir.mkdirs() - storageDir + Utils.getStorageDir() } fun init(arguments: Bundle, owner: Any) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java b/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java index 910fc6f0..d4ffae05 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java @@ -776,7 +776,8 @@ public class Utils { public static File getStorageDir() { if (storageDir != null) return storageDir; - storageDir = Environment.getExternalStoragePublicDirectory("Szkolny.eu"); + storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + storageDir = new File(storageDir, "Szkolny.eu"); storageDir.mkdirs(); return storageDir; }