Fixed dialog callbacks not working on a11 and under when blurbehind window is used

This commit is contained in:
Jays2Kings 2021-07-20 22:26:22 -04:00
parent 29c6c892c7
commit 5c0ccde9fa

View File

@ -429,17 +429,21 @@ fun Dialog.blurBehindWindow(
onDismiss: DialogInterface.OnDismissListener? = null,
onCancel: DialogInterface.OnCancelListener? = null
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
setOnShowListener {
onShow?.onShow(it)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
window?.decorView?.animateBlur(1f, blurAmount, 50)?.start()
}
}
setOnDismissListener {
onDismiss?.onDismiss(it)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
window?.decorView?.animateBlur(blurAmount, 1f, 50, true)?.start()
}
}
setOnCancelListener {
onCancel?.onCancel(it)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
window?.decorView?.animateBlur(blurAmount, 1f, 50, true)?.start()
}
}