New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplementing the multiple popups handling in the new popup solution. #1454
Conversation
Looks good to me. Let's just wait for the checks to pass. Do we also need this for the Yes/No popup? |
Oh yeah, I forgot that this changed as well. Previously when double clicking yes/no it just changed between yes/skipped/no and there was no popup. |
I gave up with the inheritance in the end, because the dialog classes sometimes inherit from AppCompatDialogFragment, sometimes from AlertDialog and sometimes from nothing at all. They use different methods to be created/dismissed so it was hard to create a universal way to handle it. |
Maybe I'll look at it as part of the next release to refactor the dialogs and align them a bit? |
Hi @kalina559, thanks for working on this. A few suggestions:
In summary, I think we could define, in a new file... var currentDialog: WeakReference<Dialog> = WeakReference(null)
fun Dialog.dismissCurrentAndShow() {
currentDialog.get()?.dismiss()
currentDialog = WeakReference(this)
show()
} ...then call |
Something like this? My only worry is that after opening and closing a dialog, it stays saved as the currentDialog, and when opening the next one, we try to dismiss a dialog that's already been closed. No error or warning is thrown though. |
Nevermind, this doesn't work yet 😀 |
Okay, now it works. The downside is the delay between showing the the first dialog, closing it and opening the next one after - previously we closed the first one immediately in show(), onCreate() or onCreateDialog() and now we create both dialogs and then check if the second one is not a 'duplicate'. |
uhabits-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/ColorPickerDialog.kt
Outdated
Show resolved
Hide resolved
...android/src/main/java/org/isoron/uhabits/activities/common/dialogs/MultipleDialogsHandler.kt
Outdated
Show resolved
Hide resolved
...android/src/main/java/org/isoron/uhabits/activities/common/dialogs/MultipleDialogsHandler.kt
Outdated
Show resolved
Hide resolved
...ts-android/src/main/java/org/isoron/uhabits/activities/common/dialogs/WeekdayPickerDialog.kt
Outdated
Show resolved
Hide resolved
Is there any way to check the ktlint report from Github Actions? Because I have no idea what's causing the checks to fail. EDIT: Turned out it was a 'Missing space after //' warning in a comment I left in the code. Not sure why, but the local ktlint check only showed it after I changed to a different branch and back. |
The previous solution was done in NumberPickerFactory class, that has been since removed. Moved the changes to the NumberPopup class, that's now used to create numerical popups.