diff options
| author | 2023-06-01 23:56:14 -0400 | |
|---|---|---|
| committer | 2023-06-03 00:06:08 -0700 | |
| commit | c927a30d09789f255d7d510f6314871658d3d97c (patch) | |
| tree | d66c05cf5749e01b760737874e92d4d236aec8eb | |
| parent | android: Warning dialogs for key errors (diff) | |
| download | yuzu-c927a30d09789f255d7d510f6314871658d3d97c.tar.gz yuzu-c927a30d09789f255d7d510f6314871658d3d97c.tar.xz yuzu-c927a30d09789f255d7d510f6314871658d3d97c.zip | |
android: Adjust import/export saves dialog
Diffstat (limited to '')
3 files changed, 21 insertions, 15 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt index 7cd2409df..67bcf8491 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/HomeSettingsFragment.kt | |||
| @@ -99,7 +99,7 @@ class HomeSettingsFragment : Fragment() { | |||
| 99 | R.drawable.ic_add | 99 | R.drawable.ic_add |
| 100 | ) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) }, | 100 | ) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) }, |
| 101 | HomeSetting( | 101 | HomeSetting( |
| 102 | R.string.import_export_saves, | 102 | R.string.manage_save_data, |
| 103 | R.string.import_export_saves_description, | 103 | R.string.import_export_saves_description, |
| 104 | R.drawable.ic_save | 104 | R.drawable.ic_save |
| 105 | ) { ImportExportSavesFragment().show(parentFragmentManager, ImportExportSavesFragment.TAG) }, | 105 | ) { ImportExportSavesFragment().show(parentFragmentManager, ImportExportSavesFragment.TAG) }, |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ImportExportSavesFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ImportExportSavesFragment.kt index 6f5068bb5..7a990d0cc 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ImportExportSavesFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/ImportExportSavesFragment.kt | |||
| @@ -68,19 +68,21 @@ class ImportExportSavesFragment : DialogFragment() { | |||
| 68 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 68 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| 69 | return if (savesFolderRoot == "") { | 69 | return if (savesFolderRoot == "") { |
| 70 | MaterialAlertDialogBuilder(requireContext()) | 70 | MaterialAlertDialogBuilder(requireContext()) |
| 71 | .setTitle(R.string.import_export_saves) | 71 | .setTitle(R.string.manage_save_data) |
| 72 | .setMessage(R.string.import_export_saves_no_profile) | 72 | .setMessage(R.string.import_export_saves_no_profile) |
| 73 | .setPositiveButton(android.R.string.ok, null) | 73 | .setPositiveButton(android.R.string.ok, null) |
| 74 | .show() | 74 | .show() |
| 75 | } else { | 75 | } else { |
| 76 | MaterialAlertDialogBuilder(requireContext()) | 76 | MaterialAlertDialogBuilder(requireContext()) |
| 77 | .setTitle(R.string.import_export_saves) | 77 | .setTitle(R.string.manage_save_data) |
| 78 | .setPositiveButton(R.string.export_saves) { _, _ -> | 78 | .setMessage(R.string.manage_save_data_description) |
| 79 | .setNegativeButton(R.string.export_saves) { _, _ -> | ||
| 79 | exportSave() | 80 | exportSave() |
| 80 | } | 81 | } |
| 81 | .setNeutralButton(R.string.import_saves) { _, _ -> | 82 | .setPositiveButton(R.string.import_saves) { _, _ -> |
| 82 | documentPicker.launch(arrayOf("application/zip")) | 83 | documentPicker.launch(arrayOf("application/zip")) |
| 83 | } | 84 | } |
| 85 | .setNeutralButton(android.R.string.cancel, null) | ||
| 84 | .show() | 86 | .show() |
| 85 | } | 87 | } |
| 86 | } | 88 | } |
| @@ -95,7 +97,10 @@ class ImportExportSavesFragment : DialogFragment() { | |||
| 95 | tempFolder.mkdirs() | 97 | tempFolder.mkdirs() |
| 96 | val saveFolder = File(savesFolderRoot) | 98 | val saveFolder = File(savesFolderRoot) |
| 97 | val outputZipFile = File( | 99 | val outputZipFile = File( |
| 98 | tempFolder, "yuzu saves - ${LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}.zip" | 100 | tempFolder, |
| 101 | "yuzu saves - ${ | ||
| 102 | LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")) | ||
| 103 | }.zip" | ||
| 99 | ) | 104 | ) |
| 100 | outputZipFile.createNewFile() | 105 | outputZipFile.createNewFile() |
| 101 | ZipOutputStream(BufferedOutputStream(FileOutputStream(outputZipFile))).use { zos -> | 106 | ZipOutputStream(BufferedOutputStream(FileOutputStream(outputZipFile))).use { zos -> |
| @@ -206,11 +211,10 @@ class ImportExportSavesFragment : DialogFragment() { | |||
| 206 | 211 | ||
| 207 | withContext(Dispatchers.Main) { | 212 | withContext(Dispatchers.Main) { |
| 208 | if (!validZip) { | 213 | if (!validZip) { |
| 209 | Toast.makeText( | 214 | MessageDialogFragment.newInstance( |
| 210 | context, | 215 | R.string.save_file_invalid_zip_structure, |
| 211 | context.getString(R.string.save_file_invalid_zip_structure), | 216 | R.string.save_file_invalid_zip_structure_description |
| 212 | Toast.LENGTH_LONG | 217 | ).show(childFragmentManager, MessageDialogFragment.TAG) |
| 213 | ).show() | ||
| 214 | return@withContext | 218 | return@withContext |
| 215 | } | 219 | } |
| 216 | Toast.makeText( | 220 | Toast.makeText( |
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index afc681fed..5fd9aa8f8 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml | |||
| @@ -87,11 +87,13 @@ | |||
| 87 | <string name="no_file_manager">No file manager found</string> | 87 | <string name="no_file_manager">No file manager found</string> |
| 88 | <string name="notification_no_directory_link">Could not open yuzu directory</string> | 88 | <string name="notification_no_directory_link">Could not open yuzu directory</string> |
| 89 | <string name="notification_no_directory_link_description">Please locate the user folder with the file manager\'s side panel manually.</string> | 89 | <string name="notification_no_directory_link_description">Please locate the user folder with the file manager\'s side panel manually.</string> |
| 90 | <string name="import_export_saves">Import/export saves</string> | 90 | <string name="manage_save_data">Manage save data</string> |
| 91 | <string name="manage_save_data_description">Save data found. Please select an option below.</string> | ||
| 91 | <string name="import_export_saves_description">Import or export save files</string> | 92 | <string name="import_export_saves_description">Import or export save files</string> |
| 92 | <string name="import_export_saves_no_profile">No user profile found. Please launch a game first and retry.</string> | 93 | <string name="import_export_saves_no_profile">No save data found. Please launch a game and retry.</string> |
| 93 | <string name="save_file_imported_success">Save files were imported successfully</string> | 94 | <string name="save_file_imported_success">Imported successfully</string> |
| 94 | <string name="save_file_invalid_zip_structure">Invalid save directory structure: The first subfolder name must be the title ID of the game.</string> | 95 | <string name="save_file_invalid_zip_structure">Invalid save directory structure</string> |
| 96 | <string name="save_file_invalid_zip_structure_description">The first subfolder name must be the title ID of the game.</string> | ||
| 95 | <string name="import_saves">Import</string> | 97 | <string name="import_saves">Import</string> |
| 96 | <string name="export_saves">Export</string> | 98 | <string name="export_saves">Export</string> |
| 97 | 99 | ||