allow making stickier dialogs by disabling cancel on touch outside

This commit is contained in:
tibbi 2021-05-10 17:52:39 +02:00
parent a32e3e91db
commit c431ae5143

View file

@ -904,7 +904,7 @@ fun Activity.updateSharedTheme(sharedTheme: SharedTheme) {
}
}
fun Activity.setupDialogStuff(view: View, dialog: AlertDialog, titleId: Int = 0, titleText: String = "", callback: (() -> Unit)? = null) {
fun Activity.setupDialogStuff(view: View, dialog: AlertDialog, titleId: Int = 0, titleText: String = "", cancelOnTouchOutside: Boolean = true, callback: (() -> Unit)? = null) {
if (isDestroyed || isFinishing) {
return
}
@ -933,7 +933,7 @@ fun Activity.setupDialogStuff(view: View, dialog: AlertDialog, titleId: Int = 0,
setView(view)
requestWindowFeature(Window.FEATURE_NO_TITLE)
setCustomTitle(title)
setCanceledOnTouchOutside(true)
setCanceledOnTouchOutside(cancelOnTouchOutside)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(adjustedPrimaryColor)
getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(adjustedPrimaryColor)