This commit is contained in:
rebelonion 2024-02-02 02:43:29 -06:00
parent a3be59bd02
commit f7c7b8050f
2 changed files with 12 additions and 9 deletions

View file

@ -264,18 +264,21 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
}
binding.importExportSettings.setOnClickListener {
var i = 0
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
.setTitle("Import/Export Settings")
.setSingleChoiceItems(Location.entries.map { it.name }.toTypedArray(), 0) { dialog, which ->
selectedImpExp = Location.entries[which].name
i = which
}
.setPositiveButton("Import...") { dialog, _ ->
openDocumentLauncher.launch("Select a file")
dialog.dismiss()
}
.setNegativeButton("Export...") { dialog, which ->
savePrefsToDownloads(Location.entries[which].name,
PrefManager.exportAllPrefs(Location.entries[which]),
.setNegativeButton("Export...") { dialog, _ ->
if (i < 0) return@setNegativeButton
savePrefsToDownloads(Location.entries[i].name,
PrefManager.exportAllPrefs(Location.entries[i]),
this@SettingsActivity)
dialog.dismiss()
}