Browse Source

Fix error message when creating volume on external SD card

master
Hardcore Sushi 4 months ago
parent
commit
d6f727a142
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
  1. 8
      app/src/main/java/sushi/hardcore/droidfs/add_volume/SelectPathFragment.kt
  2. 3
      app/src/main/res/layout/dialog_sdcard_error.xml
  3. 3
      app/src/main/res/values/strings.xml

8
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<TextView>(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)

3
app/src/main/res/layout/dialog_sdcard_error.xml

@ -21,9 +21,10 @@
android:layout_marginVertical="10dp"/>
<TextView
android:id="@+id/footer"
android:layout_width="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"/>
</LinearLayout>

3
app/src/main/res/values/strings.xml

@ -130,9 +130,10 @@
<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="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="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_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>

Loading…
Cancel
Save