Skip to content

Commit

Permalink
use positive instead of neutral for single OK button
Browse files Browse the repository at this point in the history
  • Loading branch information
danny8376 committed Nov 15, 2023
1 parent 82434d6 commit feac15b
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,14 @@ class MSET9Installer : Fragment() {
}
}

private fun showAlert(title: String, message: String, neutral: String? = null, setup: ((AlertDialog.Builder) -> AlertDialog.Builder)? = null) {
private fun showAlert(title: String, message: String, neutral: String = getString(R.string.alert_neutral), setup: ((AlertDialog.Builder) -> AlertDialog.Builder)? = null) {
val builder = AlertDialog.Builder(mainActivity)
.setTitle(title)
.setMessage(message)
if (neutral != null) {
builder.setNeutralButton(neutral) { _, _ -> }
}
if (setup != null) {
setup(builder)
} else {
builder.setNeutralButton(getString(R.string.alert_neutral)) { _, _ -> }
builder.setPositiveButton(neutral) { _, _ -> }
}
builder.show()
}
Expand Down

0 comments on commit feac15b

Please sign in to comment.