diff --git a/app/src/main/java/awais/instagrabber/activities/DirectorySelectActivity.java b/app/src/main/java/awais/instagrabber/activities/DirectorySelectActivity.java index e0c72194..681e92df 100644 --- a/app/src/main/java/awais/instagrabber/activities/DirectorySelectActivity.java +++ b/app/src/main/java/awais/instagrabber/activities/DirectorySelectActivity.java @@ -82,7 +82,7 @@ public class DirectorySelectActivity extends BaseLanguageActivity { return; } if (!"com.android.externalstorage.documents".equals(data.getData().getAuthority())) { - showErrorDialog(getString(R.string.dir_select_no_download_folder)); + showErrorDialog(getString(R.string.dir_select_no_download_folder, data.getData().getAuthority())); return; } AppExecutors.INSTANCE.getMainThread().execute(() -> { diff --git a/app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java b/app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java index 5a2a2de0..16f0e902 100644 --- a/app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java @@ -111,7 +111,7 @@ public class DownloadsPreferencesFragment extends BasePreferencesFragment { R.string.error, "com.android.externalstorage.documents".equals(data.getData().getAuthority()) ? "Please report this error to the developers:\n\n" + sw.toString() - : getString(R.string.dir_select_no_download_folder), + : getString(R.string.dir_select_no_download_folder, data.getData().getAuthority()), R.string.ok, 0, 0 diff --git a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.kt b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.kt index 31157157..e7674a90 100644 --- a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.kt +++ b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.kt @@ -38,8 +38,6 @@ object DownloadUtils { private const val DIR_TEMP = "Temp" private const val DIR_BACKUPS = "Backups" private var root: DocumentFile? = null - const val WRITE_PERMISSION = Manifest.permission.WRITE_EXTERNAL_STORAGE - val PERMS = arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE) @JvmStatic @Throws(ReselectDocumentTreeException::class) fun init( @@ -49,11 +47,11 @@ object DownloadUtils { if (isEmpty(barinstaDirUri)) { throw ReselectDocumentTreeException("folder path is null or empty") } + val uri = Uri.parse(barinstaDirUri) if (!barinstaDirUri!!.startsWith("content://com.android.externalstorage.documents")) { // reselect the folder in selector view - throw ReselectDocumentTreeException(Uri.parse(barinstaDirUri)) + throw ReselectDocumentTreeException(uri) } - val uri = Uri.parse(barinstaDirUri) val existingPermissions = context.contentResolver.persistedUriPermissions if (existingPermissions.isEmpty()) { // reselect the folder in selector view @@ -150,7 +148,7 @@ object DownloadUtils { list.add(DIR_DOWNLOADS) return list } - val finalUsername = if (username!!.startsWith("@")) username.substring(1) else username + val finalUsername = if (username.startsWith("@")) username.substring(1) else username list.add(DIR_DOWNLOADS) list.add(finalUsername) return list @@ -337,7 +335,7 @@ object DownloadUtils { private fun checkPathExists(paths: List, context: Context): Boolean { if (root == null) return false - val uri = root!!.getUri() + val uri = root!!.uri var found = false var docId = DocumentsContract.getTreeDocumentId(uri) for (path in paths) { @@ -349,7 +347,7 @@ object DownloadUtils { ), null, null, null ) if (docCursor == null) return false - while (docCursor!!.moveToNext() && !found) { + while (docCursor.moveToNext() && !found) { if (path.equals(docCursor.getString(0))) { docId = docCursor.getString(1) found = true diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 41bdfa11..dc29288c 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -512,7 +512,7 @@ The previously selected folder does not exist now: Re-select the directory or select a new directory by clicking the button below. No folder selected! - Please choose a directory from your storage, not a category on the sidebar. + Please choose a directory from your storage, not a category on the sidebar.\n(%s) Success! Please wait. Starting app… Barinsta folder Top