mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Compare commits
1 Commits
hotfix/2.1
...
25a3509988
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25a3509988 |
@@ -73,6 +73,7 @@ class NumberPopup(
|
||||
}
|
||||
|
||||
fun show() {
|
||||
clearCurrentDialog()
|
||||
dialog = Dialog(context, android.R.style.Theme_NoTitleBar)
|
||||
dialog.setContentView(view.root)
|
||||
dialog.window?.apply {
|
||||
@@ -84,6 +85,7 @@ class NumberPopup(
|
||||
}
|
||||
dialog.setOnDismissListener {
|
||||
onDismiss()
|
||||
currentDialog = null
|
||||
}
|
||||
|
||||
view.value.setOnKeyListener { _, keyCode, event ->
|
||||
@@ -103,6 +105,7 @@ class NumberPopup(
|
||||
view.value.requestFocusWithKeyboard()
|
||||
dialog.setCanceledOnTouchOutside(true)
|
||||
dialog.dimBehind()
|
||||
currentDialog = dialog
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
@@ -112,4 +115,14 @@ class NumberPopup(
|
||||
onToggle(value, notes)
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Used to make sure that 2 popups aren't shown on top of each other
|
||||
// If dialog that's already shown is detected, it's dismissed before the next one is opened.
|
||||
private var currentDialog: Dialog? = null
|
||||
fun clearCurrentDialog() {
|
||||
currentDialog?.dismiss()
|
||||
currentDialog = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user