mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-19 20:29:02 +00:00
improve dialog queue
This commit is contained in:
parent
329ed7f212
commit
e39c0bf643
1 changed files with 12 additions and 1 deletions
|
|
@ -301,10 +301,21 @@ open class HabiticaAlertDialog(context: Context) : AlertDialog(context, R.style.
|
|||
}
|
||||
|
||||
private fun addToQueue(dialog: HabiticaAlertDialog) {
|
||||
if (dialogQueue.isEmpty()) {
|
||||
if (checkIfQueueAvailable()) {
|
||||
dialog.show()
|
||||
}
|
||||
dialogQueue.add(dialog)
|
||||
}
|
||||
|
||||
private fun checkIfQueueAvailable(): Boolean {
|
||||
val currentDialog = dialogQueue.firstOrNull() ?: return true
|
||||
if (currentDialog.isShowing) {
|
||||
return false
|
||||
} else {
|
||||
// The Dialog was probably dismissed in a weird way. Clear it out so that the queue doesn't get stuck
|
||||
dialogQueue.removeAt(0)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue