From d6f727a142b15259701693c4c0c36a4d498c487f Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Mon, 7 Mar 2022 12:58:46 +0100 Subject: [PATCH] Fix error message when creating volume on external SD card --- .../hardcore/droidfs/add_volume/SelectPathFragment.kt | 8 +++++--- app/src/main/res/layout/dialog_sdcard_error.xml | 3 ++- app/src/main/res/values/strings.xml | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/sushi/hardcore/droidfs/add_volume/SelectPathFragment.kt b/app/src/main/java/sushi/hardcore/droidfs/add_volume/SelectPathFragment.kt index 9cd49f2..4bde96d 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/add_volume/SelectPathFragment.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/add_volume/SelectPathFragment.kt @@ -237,6 +237,7 @@ class SelectPathFragment: Fragment() { dialog.setView( DialogSdcardErrorBinding.inflate(layoutInflater).apply { path.text = PathUtils.getPackageDataFolder(requireContext()) + footer.text = getString(R.string.sdcard_error_add_footer) }.root ) else @@ -250,6 +251,7 @@ class SelectPathFragment: Fragment() { } } + // called when the user tries to create a volume in a non-writable directory private fun errorDirectoryNotWritable(volumePath: String) { val dialog = CustomAlertDialogBuilder(requireContext(), themeValue) .setTitle(R.string.error) @@ -257,9 +259,9 @@ class SelectPathFragment: Fragment() { @SuppressLint("InflateParams") if (PathUtils.isPathOnExternalStorage(volumePath, requireContext())) dialog.setView( - layoutInflater.inflate(R.layout.dialog_sdcard_error, null).apply { - findViewById(R.id.path).text = PathUtils.getPackageDataFolder(requireContext()) - } + DialogSdcardErrorBinding.inflate(layoutInflater).apply { + path.text = PathUtils.getPackageDataFolder(requireContext()) + }.root ) else dialog.setMessage(R.string.create_cant_write_error_msg) diff --git a/app/src/main/res/layout/dialog_sdcard_error.xml b/app/src/main/res/layout/dialog_sdcard_error.xml index b0164cd..6d8717f 100644 --- a/app/src/main/res/layout/dialog_sdcard_error.xml +++ b/app/src/main/res/layout/dialog_sdcard_error.xml @@ -21,9 +21,10 @@ android:layout_marginVertical="10dp"/> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa30e40..d42e912 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -130,9 +130,10 @@ Please enter a numeric value Failed to retrieve the selected path. DroidFS doesn\'t have write access to this path. Please try another location. - Adding volume with read-only access. DroidFS doesn\'t have write access to this path. Adding volume with read-only access. DroidFS can only write to removable SD cards under: + Adding volume with read-only access. + Please use a subdirectory of this path or internal storage. Slideshow stopped Slideshow started The image has been rotated. Do you want to save these changes and overwrite the original image ?