Fix yes in onBackPressed

This commit is contained in:
Mygod 2019-02-12 19:34:28 +08:00
parent 47e3dbc34b
commit 70cc6094ab

View file

@ -60,7 +60,10 @@ class ConfigActivity : ConfigurationActivity(), Toolbar.OnMenuItemClickListener
override fun onBackPressed() { override fun onBackPressed() {
if (child.options != oldOptions) AlertDialog.Builder(this).run { if (child.options != oldOptions) AlertDialog.Builder(this).run {
setTitle(R.string.unsaved_changes_prompt) setTitle(R.string.unsaved_changes_prompt)
setPositiveButton(R.string.yes) { _, _ -> saveChanges(child.options) } setPositiveButton(R.string.yes) { _, _ ->
saveChanges(child.options)
finish()
}
setNegativeButton(R.string.no) { _, _ -> finish() } setNegativeButton(R.string.no) { _, _ -> finish() }
setNeutralButton(android.R.string.cancel, null) setNeutralButton(android.R.string.cancel, null)
create() create()