Merge pull request #10564 from t895/warnings
android: Adjust various warnings
This commit is contained in:
commit
6273e1f2bd
5 changed files with 117 additions and 47 deletions
|
@ -99,7 +99,7 @@ class HomeSettingsFragment : Fragment() {
|
||||||
R.drawable.ic_add
|
R.drawable.ic_add
|
||||||
) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) },
|
) { mainActivity.getGamesDirectory.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).data) },
|
||||||
HomeSetting(
|
HomeSetting(
|
||||||
R.string.import_export_saves,
|
R.string.manage_save_data,
|
||||||
R.string.import_export_saves_description,
|
R.string.import_export_saves_description,
|
||||||
R.drawable.ic_save
|
R.drawable.ic_save
|
||||||
) { ImportExportSavesFragment().show(parentFragmentManager, ImportExportSavesFragment.TAG) },
|
) { ImportExportSavesFragment().show(parentFragmentManager, ImportExportSavesFragment.TAG) },
|
||||||
|
|
|
@ -68,19 +68,21 @@ class ImportExportSavesFragment : DialogFragment() {
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
return if (savesFolderRoot == "") {
|
return if (savesFolderRoot == "") {
|
||||||
MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setTitle(R.string.import_export_saves)
|
.setTitle(R.string.manage_save_data)
|
||||||
.setMessage(R.string.import_export_saves_no_profile)
|
.setMessage(R.string.import_export_saves_no_profile)
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.show()
|
.show()
|
||||||
} else {
|
} else {
|
||||||
MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setTitle(R.string.import_export_saves)
|
.setTitle(R.string.manage_save_data)
|
||||||
.setPositiveButton(R.string.export_saves) { _, _ ->
|
.setMessage(R.string.manage_save_data_description)
|
||||||
|
.setNegativeButton(R.string.export_saves) { _, _ ->
|
||||||
exportSave()
|
exportSave()
|
||||||
}
|
}
|
||||||
.setNeutralButton(R.string.import_saves) { _, _ ->
|
.setPositiveButton(R.string.import_saves) { _, _ ->
|
||||||
documentPicker.launch(arrayOf("application/zip"))
|
documentPicker.launch(arrayOf("application/zip"))
|
||||||
}
|
}
|
||||||
|
.setNeutralButton(android.R.string.cancel, null)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +97,10 @@ class ImportExportSavesFragment : DialogFragment() {
|
||||||
tempFolder.mkdirs()
|
tempFolder.mkdirs()
|
||||||
val saveFolder = File(savesFolderRoot)
|
val saveFolder = File(savesFolderRoot)
|
||||||
val outputZipFile = File(
|
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()
|
outputZipFile.createNewFile()
|
||||||
ZipOutputStream(BufferedOutputStream(FileOutputStream(outputZipFile))).use { zos ->
|
ZipOutputStream(BufferedOutputStream(FileOutputStream(outputZipFile))).use { zos ->
|
||||||
|
@ -206,11 +211,10 @@ class ImportExportSavesFragment : DialogFragment() {
|
||||||
|
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
if (!validZip) {
|
if (!validZip) {
|
||||||
Toast.makeText(
|
MessageDialogFragment.newInstance(
|
||||||
context,
|
R.string.save_file_invalid_zip_structure,
|
||||||
context.getString(R.string.save_file_invalid_zip_structure),
|
R.string.save_file_invalid_zip_structure_description
|
||||||
Toast.LENGTH_LONG
|
).show(childFragmentManager, MessageDialogFragment.TAG)
|
||||||
).show()
|
|
||||||
return@withContext
|
return@withContext
|
||||||
}
|
}
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
package org.yuzu.yuzu_emu.fragments
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import org.yuzu.yuzu_emu.R
|
||||||
|
|
||||||
|
class MessageDialogFragment : DialogFragment() {
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
val titleId = requireArguments().getInt(TITLE)
|
||||||
|
val descriptionId = requireArguments().getInt(DESCRIPTION)
|
||||||
|
val helpLinkId = requireArguments().getInt(HELP_LINK)
|
||||||
|
|
||||||
|
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||||
|
.setPositiveButton(R.string.close, null)
|
||||||
|
.setTitle(titleId)
|
||||||
|
.setMessage(descriptionId)
|
||||||
|
|
||||||
|
if (helpLinkId != 0) {
|
||||||
|
dialog.setNeutralButton(R.string.learn_more) { _, _ ->
|
||||||
|
openLink(getString(helpLinkId))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openLink(link: String) {
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(link))
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TAG = "MessageDialogFragment"
|
||||||
|
|
||||||
|
private const val TITLE = "Title"
|
||||||
|
private const val DESCRIPTION = "Description"
|
||||||
|
private const val HELP_LINK = "Link"
|
||||||
|
|
||||||
|
fun newInstance(
|
||||||
|
titleId: Int,
|
||||||
|
descriptionId: Int,
|
||||||
|
helpLinkId: Int = 0
|
||||||
|
): MessageDialogFragment {
|
||||||
|
val dialog = MessageDialogFragment()
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.apply {
|
||||||
|
putInt(TITLE, titleId)
|
||||||
|
putInt(DESCRIPTION, descriptionId)
|
||||||
|
putInt(HELP_LINK, helpLinkId)
|
||||||
|
}
|
||||||
|
dialog.arguments = bundle
|
||||||
|
return dialog
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ import org.yuzu.yuzu_emu.databinding.DialogProgressBarBinding
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
|
import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
|
||||||
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
|
||||||
|
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
import org.yuzu.yuzu_emu.utils.*
|
import org.yuzu.yuzu_emu.utils.*
|
||||||
|
@ -251,11 +252,9 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
if (result == null)
|
if (result == null)
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
|
|
||||||
val takeFlags =
|
|
||||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
|
||||||
contentResolver.takePersistableUriPermission(
|
contentResolver.takePersistableUriPermission(
|
||||||
result,
|
result,
|
||||||
takeFlags
|
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
)
|
)
|
||||||
|
|
||||||
// When a new directory is picked, we currently will reset the existing games
|
// When a new directory is picked, we currently will reset the existing games
|
||||||
|
@ -279,19 +278,16 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
|
|
||||||
if (!FileUtil.hasExtension(result.toString(), "keys")) {
|
if (!FileUtil.hasExtension(result.toString(), "keys")) {
|
||||||
Toast.makeText(
|
MessageDialogFragment.newInstance(
|
||||||
applicationContext,
|
R.string.reading_keys_failure,
|
||||||
R.string.invalid_keys_file,
|
R.string.install_keys_failure_extension_description
|
||||||
Toast.LENGTH_SHORT
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
).show()
|
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
}
|
}
|
||||||
|
|
||||||
val takeFlags =
|
|
||||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
|
||||||
contentResolver.takePersistableUriPermission(
|
contentResolver.takePersistableUriPermission(
|
||||||
result,
|
result,
|
||||||
takeFlags
|
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
)
|
)
|
||||||
|
|
||||||
val dstPath = DirectoryInitialization.userDirectory + "/keys/"
|
val dstPath = DirectoryInitialization.userDirectory + "/keys/"
|
||||||
|
@ -310,11 +306,11 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
).show()
|
).show()
|
||||||
gamesViewModel.reloadGames(true)
|
gamesViewModel.reloadGames(true)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
MessageDialogFragment.newInstance(
|
||||||
applicationContext,
|
R.string.invalid_keys_error,
|
||||||
R.string.install_keys_failure,
|
R.string.install_keys_failure_description,
|
||||||
Toast.LENGTH_LONG
|
R.string.dumping_keys_quickstart_link
|
||||||
).show()
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,19 +321,16 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
|
|
||||||
if (!FileUtil.hasExtension(result.toString(), "bin")) {
|
if (!FileUtil.hasExtension(result.toString(), "bin")) {
|
||||||
Toast.makeText(
|
MessageDialogFragment.newInstance(
|
||||||
applicationContext,
|
R.string.reading_keys_failure,
|
||||||
R.string.invalid_keys_file,
|
R.string.install_keys_failure_extension_description
|
||||||
Toast.LENGTH_SHORT
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
).show()
|
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
}
|
}
|
||||||
|
|
||||||
val takeFlags =
|
|
||||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
|
||||||
contentResolver.takePersistableUriPermission(
|
contentResolver.takePersistableUriPermission(
|
||||||
result,
|
result,
|
||||||
takeFlags
|
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
)
|
)
|
||||||
|
|
||||||
val dstPath = DirectoryInitialization.userDirectory + "/keys/"
|
val dstPath = DirectoryInitialization.userDirectory + "/keys/"
|
||||||
|
@ -355,11 +348,11 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
MessageDialogFragment.newInstance(
|
||||||
applicationContext,
|
R.string.invalid_keys_error,
|
||||||
R.string.install_amiibo_keys_failure,
|
R.string.install_keys_failure_description,
|
||||||
Toast.LENGTH_LONG
|
R.string.dumping_keys_quickstart_link
|
||||||
).show()
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,15 @@
|
||||||
<string name="install_amiibo_keys_description">Required to use Amiibo in game</string>
|
<string name="install_amiibo_keys_description">Required to use Amiibo in game</string>
|
||||||
<string name="invalid_keys_file">Invalid keys file selected</string>
|
<string name="invalid_keys_file">Invalid keys file selected</string>
|
||||||
<string name="install_keys_success">Keys successfully installed</string>
|
<string name="install_keys_success">Keys successfully installed</string>
|
||||||
<string name="install_keys_failure">Keys file (prod.keys) is invalid</string>
|
<string name="reading_keys_failure">Error reading encryption keys</string>
|
||||||
<string name="install_amiibo_keys_failure">Keys file (key_retail.bin) is invalid</string>
|
<string name="install_keys_failure_extension_description">
|
||||||
|
1. Verify your keys have the .keys extension.\n\n
|
||||||
|
2. Keys must not be stored in the Downloads folder.\n\n
|
||||||
|
Resolve the issue(s) and try again.
|
||||||
|
</string>
|
||||||
|
<string name="invalid_keys_error">Invalid encryption keys</string>
|
||||||
|
<string name="dumping_keys_quickstart_link">https://yuzu-emu.org/help/quickstart/#dumping-decryption-keys</string>
|
||||||
|
<string name="install_keys_failure_description">The selected file is incorrect or corrupt. Please redump your keys.</string>
|
||||||
<string name="install_gpu_driver">Install GPU driver</string>
|
<string name="install_gpu_driver">Install GPU driver</string>
|
||||||
<string name="install_gpu_driver_description">Install alternative drivers for potentially better performance or accuracy</string>
|
<string name="install_gpu_driver_description">Install alternative drivers for potentially better performance or accuracy</string>
|
||||||
<string name="advanced_settings">Advanced settings</string>
|
<string name="advanced_settings">Advanced settings</string>
|
||||||
|
@ -80,11 +87,13 @@
|
||||||
<string name="no_file_manager">No file manager found</string>
|
<string name="no_file_manager">No file manager found</string>
|
||||||
<string name="notification_no_directory_link">Could not open yuzu directory</string>
|
<string name="notification_no_directory_link">Could not open yuzu directory</string>
|
||||||
<string name="notification_no_directory_link_description">Please locate the user folder with the file manager\'s side panel manually.</string>
|
<string name="notification_no_directory_link_description">Please locate the user folder with the file manager\'s side panel manually.</string>
|
||||||
<string name="import_export_saves">Import/export saves</string>
|
<string name="manage_save_data">Manage save data</string>
|
||||||
|
<string name="manage_save_data_description">Save data found. Please select an option below.</string>
|
||||||
<string name="import_export_saves_description">Import or export save files</string>
|
<string name="import_export_saves_description">Import or export save files</string>
|
||||||
<string name="import_export_saves_no_profile">No user profile found. Please launch a game first and retry.</string>
|
<string name="import_export_saves_no_profile">No save data found. Please launch a game and retry.</string>
|
||||||
<string name="save_file_imported_success">Save files were imported successfully</string>
|
<string name="save_file_imported_success">Imported successfully</string>
|
||||||
<string name="save_file_invalid_zip_structure">Invalid save directory structure: The first subfolder name must be the title ID of the game.</string>
|
<string name="save_file_invalid_zip_structure">Invalid save directory structure</string>
|
||||||
|
<string name="save_file_invalid_zip_structure_description">The first subfolder name must be the title ID of the game.</string>
|
||||||
<string name="import_saves">Import</string>
|
<string name="import_saves">Import</string>
|
||||||
<string name="export_saves">Export</string>
|
<string name="export_saves">Export</string>
|
||||||
|
|
||||||
|
@ -164,6 +173,8 @@
|
||||||
<string name="reset_all_settings">Reset all settings?</string>
|
<string name="reset_all_settings">Reset all settings?</string>
|
||||||
<string name="reset_all_settings_description">All Advanced Settings will be reset to their default configuration. This can not be undone.</string>
|
<string name="reset_all_settings_description">All Advanced Settings will be reset to their default configuration. This can not be undone.</string>
|
||||||
<string name="settings_reset">Settings reset</string>
|
<string name="settings_reset">Settings reset</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
|
<string name="learn_more">Learn More</string>
|
||||||
|
|
||||||
<!-- GPU driver installation -->
|
<!-- GPU driver installation -->
|
||||||
<string name="select_gpu_driver">Select GPU driver</string>
|
<string name="select_gpu_driver">Select GPU driver</string>
|
||||||
|
@ -211,7 +222,7 @@
|
||||||
<string name="emulation_touch_overlay_edit">Edit Overlay</string>
|
<string name="emulation_touch_overlay_edit">Edit Overlay</string>
|
||||||
<string name="emulation_pause">Pause Emulation</string>
|
<string name="emulation_pause">Pause Emulation</string>
|
||||||
<string name="emulation_unpause">Unpause Emulation</string>
|
<string name="emulation_unpause">Unpause Emulation</string>
|
||||||
<string name="emulation_input_overlay">Input Overlay</string>
|
<string name="emulation_input_overlay">Overlay Options</string>
|
||||||
<string name="emulation_game_loading">Game loading…</string>
|
<string name="emulation_game_loading">Game loading…</string>
|
||||||
|
|
||||||
<string name="load_settings">Loading Settings…</string>
|
<string name="load_settings">Loading Settings…</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue