ui: ensure updateOkButtonEnablement() runs after buttons exist in ShopGoneDialog#6322
Conversation
…pGoneDialog updateOkButtonEnablement() was called during init when getButton(BUTTON_POSITIVE) may return null. Move to show() after super.show() to ensure button state update actually executes, addressing potential timing issue.
|
What? Where? I don't see any |
|
So So in So the button won't be deactivated if That's why I think we need to call it again, after the button exists. |
|
In line 67 the button is created. |
|
I'm sorry, but I don't think so. Line 67 just stores, that you want a button, but you can only access it after it is created by
|
|
then, why does it work currently? |
|
Looking at the code and the documentation, I have no idea. As I said, I'm not good at UI stuff in general. But I still wanted to make the suggestion, as it doesn't hurt anything to send the button twice a signal to be "disabled". |
|
Well, I guess we can merge it. You did test it to ensure that there are no regressions? I/we are in the progress of recreating the UI in compose, so I don't really want to spend time on hunting things that could be bugs in the old UI implementation. |
Ah, alright, makes sense. Yeah I read your post about how to help and looked already at the source code of maplibre-compose.
I remember building it, but I think it did not test it. I'll do this now to be sure and report back :) |
Migrating to maplibre-compose is the next big thing on my list. The author of that library already added the one missing feature that blocked integration of that library into StreetComplete 🎉. Migrating to that lib is a big item on the list, so if you are looking to contribute some stuff, better start with something small :-) - e.g. some quest form. |
Alright, I'll have a look if I got time to spare :) Regarding this issue. Tested on Android 12 on my phone: I've just cherry-picked this onto |
updateOkButtonEnablement() was called during init when getButton(BUTTON_POSITIVE) may return null. Move to show() after super.show() to ensure button state update actually executes, addressing potential timing issue.
UI is not my can of worms, but I think I found a bug here.
During the init()
updateOkButtonEnablement()is called, but since the button does not exist yetgetButton()will return NULL here, which is masked by?..This can lead to the button not being disabled, despite the user not yet having selected an element from the list.