From c927a30d09789f255d7d510f6314871658d3d97c Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Thu, 1 Jun 2023 23:56:14 -0400 Subject: [PATCH] android: Adjust import/export saves dialog --- .../fragments/HomeSettingsFragment.kt | 2 +- .../fragments/ImportExportSavesFragment.kt | 24 +++++++++++-------- .../app/src/main/res/values/strings.xml | 10 ++++---- 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() { R.drawable.ic_add ) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) }, HomeSetting( - R.string.import_export_saves, + R.string.manage_save_data, R.string.import_export_saves_description, R.drawable.ic_save ) { 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() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { return if (savesFolderRoot == "") { MaterialAlertDialogBuilder(requireContext()) - .setTitle(R.string.import_export_saves) + .setTitle(R.string.manage_save_data) .setMessage(R.string.import_export_saves_no_profile) .setPositiveButton(android.R.string.ok, null) .show() } else { MaterialAlertDialogBuilder(requireContext()) - .setTitle(R.string.import_export_saves) - .setPositiveButton(R.string.export_saves) { _, _ -> + .setTitle(R.string.manage_save_data) + .setMessage(R.string.manage_save_data_description) + .setNegativeButton(R.string.export_saves) { _, _ -> exportSave() } - .setNeutralButton(R.string.import_saves) { _, _ -> + .setPositiveButton(R.string.import_saves) { _, _ -> documentPicker.launch(arrayOf("application/zip")) } + .setNeutralButton(android.R.string.cancel, null) .show() } } @@ -95,7 +97,10 @@ class ImportExportSavesFragment : DialogFragment() { tempFolder.mkdirs() val saveFolder = File(savesFolderRoot) val outputZipFile = File( - tempFolder, "yuzu saves - ${LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))}.zip" + tempFolder, + "yuzu saves - ${ + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")) + }.zip" ) outputZipFile.createNewFile() ZipOutputStream(BufferedOutputStream(FileOutputStream(outputZipFile))).use { zos -> @@ -206,11 +211,10 @@ class ImportExportSavesFragment : DialogFragment() { withContext(Dispatchers.Main) { if (!validZip) { - Toast.makeText( - context, - context.getString(R.string.save_file_invalid_zip_structure), - Toast.LENGTH_LONG - ).show() + MessageDialogFragment.newInstance( + R.string.save_file_invalid_zip_structure, + R.string.save_file_invalid_zip_structure_description + ).show(childFragmentManager, MessageDialogFragment.TAG) return@withContext } 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 @@ No file manager found Could not open yuzu directory Please locate the user folder with the file manager\'s side panel manually. - Import/export saves + Manage save data + Save data found. Please select an option below. Import or export save files - No user profile found. Please launch a game first and retry. - Save files were imported successfully - Invalid save directory structure: The first subfolder name must be the title ID of the game. + No save data found. Please launch a game and retry. + Imported successfully + Invalid save directory structure + The first subfolder name must be the title ID of the game. Import Export