|
|
@ -45,10 +45,18 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener |
|
|
|
viewModel.importLocal(it) |
|
|
|
viewModel.importLocal(it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
private val exportDirResult = registerForActivityResult(HandleFileContract()) { |
|
|
|
private val exportDirResult = registerForActivityResult(HandleFileContract()) { uri -> |
|
|
|
it?.let { |
|
|
|
uri ?: return@registerForActivityResult |
|
|
|
viewModel.export(it) |
|
|
|
alert(R.string.export_success) { |
|
|
|
} |
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
|
|
|
|
editView.hint = getString(R.string.path) |
|
|
|
|
|
|
|
editView.setText(uri.toString()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
customView { alertBinding.root } |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
requireContext().sendToClip(uri.toString()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onStart() { |
|
|
|
override fun onStart() { |
|
|
@ -118,7 +126,11 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener |
|
|
|
allowExtensions = arrayOf("txt", "json") |
|
|
|
allowExtensions = arrayOf("txt", "json") |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_import_onLine -> importAlert() |
|
|
|
R.id.menu_import_onLine -> importAlert() |
|
|
|
R.id.menu_export -> exportDirResult.launch(null) |
|
|
|
R.id.menu_export -> exportDirResult.launch { |
|
|
|
|
|
|
|
mode = HandleFileContract.EXPORT |
|
|
|
|
|
|
|
fileName = "httpTts.json" |
|
|
|
|
|
|
|
file = GSON.toJson(adapter.getItems()).toByteArray() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|