Fix error message when creating volume on external SD card

This commit is contained in:
Matéo Duparc 2022-03-07 12:58:46 +01:00
parent 6d5fc465c7
commit d6f727a142
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
3 changed files with 9 additions and 5 deletions

View File

@ -237,6 +237,7 @@ class SelectPathFragment: Fragment() {
dialog.setView( dialog.setView(
DialogSdcardErrorBinding.inflate(layoutInflater).apply { DialogSdcardErrorBinding.inflate(layoutInflater).apply {
path.text = PathUtils.getPackageDataFolder(requireContext()) path.text = PathUtils.getPackageDataFolder(requireContext())
footer.text = getString(R.string.sdcard_error_add_footer)
}.root }.root
) )
else 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) { private fun errorDirectoryNotWritable(volumePath: String) {
val dialog = CustomAlertDialogBuilder(requireContext(), themeValue) val dialog = CustomAlertDialogBuilder(requireContext(), themeValue)
.setTitle(R.string.error) .setTitle(R.string.error)
@ -257,9 +259,9 @@ class SelectPathFragment: Fragment() {
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
if (PathUtils.isPathOnExternalStorage(volumePath, requireContext())) if (PathUtils.isPathOnExternalStorage(volumePath, requireContext()))
dialog.setView( dialog.setView(
layoutInflater.inflate(R.layout.dialog_sdcard_error, null).apply { DialogSdcardErrorBinding.inflate(layoutInflater).apply {
findViewById<TextView>(R.id.path).text = PathUtils.getPackageDataFolder(requireContext()) path.text = PathUtils.getPackageDataFolder(requireContext())
} }.root
) )
else else
dialog.setMessage(R.string.create_cant_write_error_msg) dialog.setMessage(R.string.create_cant_write_error_msg)

View File

@ -21,9 +21,10 @@
android:layout_marginVertical="10dp"/> android:layout_marginVertical="10dp"/>
<TextView <TextView
android:id="@+id/footer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/add_read_only" android:text="@string/sdcard_error_create_footer"
android:textSize="@dimen/dialog_text_size"/> android:textSize="@dimen/dialog_text_size"/>
</LinearLayout> </LinearLayout>

View File

@ -130,9 +130,10 @@
<string name="timer_empty_error_msg">Please enter a numeric value</string> <string name="timer_empty_error_msg">Please enter a numeric value</string>
<string name="path_error">Failed to retrieve the selected path.</string> <string name="path_error">Failed to retrieve the selected path.</string>
<string name="create_cant_write_error_msg">DroidFS doesn\'t have write access to this path. Please try another location.</string> <string name="create_cant_write_error_msg">DroidFS doesn\'t have write access to this path. Please try another location.</string>
<string name="add_read_only">Adding volume with read-only access.</string>
<string name="add_cant_write_warning">DroidFS doesn\'t have write access to this path. Adding volume with read-only access.</string> <string name="add_cant_write_warning">DroidFS doesn\'t have write access to this path. Adding volume with read-only access.</string>
<string name="sdcard_error_header">DroidFS can only write to removable SD cards under:</string> <string name="sdcard_error_header">DroidFS can only write to removable SD cards under:</string>
<string name="sdcard_error_add_footer">Adding volume with read-only access.</string>
<string name="sdcard_error_create_footer">Please use a subdirectory of this path or internal storage.</string>
<string name="slideshow_stopped">Slideshow stopped</string> <string name="slideshow_stopped">Slideshow stopped</string>
<string name="slideshow_started">Slideshow started</string> <string name="slideshow_started">Slideshow started</string>
<string name="ask_save_img_rotated">The image has been rotated. Do you want to save these changes and overwrite the original image ?</string> <string name="ask_save_img_rotated">The image has been rotated. Do you want to save these changes and overwrite the original image ?</string>