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
showPanel() not working shortly after hidePanel() and vice versa #345
Comments
Please execute the call on the handler. Also, keep in mind that the API is changing in the upcoming version 3.0 36c0063 |
@subodh-malgonde I ended up forking the latest version of this library, having a "queuedState" variable, and having a timer check the currentState with the queuedState every half second to ensure setPanelState() worked correctly. It's not the best solution but at least it works now. |
@Pkmmte Thanks, but I could not find any "queuedState" variable in the latest version? I am looking in the SlidingUpPanelLayout.java. Can you maybe explain with a code snippet? |
@subodh-malgonde Essentially, I just created a variable called mQueuedState and a Runnable which compares it to mSlideState recursively. When the view is constructed, it calls a fixState() function that executes that runnable with a 500 millisecond delay. In short:
The full gist I made for it: |
If I call hidePanel() and shortly afterwards call showPanel(), the showPanel() call gets ignored if called too soon. I think it's because the panel is sliding animating to the hidden state when I call showPanel() and therefore ignores the call. It's easy to replicate this issue by simply calling those two together, maybe with some slight delay.
I understand we're not supposed to use these two so quickly but here's my use case: In my app, the panel hides when user starts dragging the map and reappears when they stop dragging and new data loads. This works fine and all but in some cases my data loads so fast that the panel has yet to finish hiding and therefore ignores the second call.
Example:
https://play.google.com/store/apps/details?id=co.nowl
Right after clicking the location button, the panel hides and refuses to appear again until something else triggers it.
The text was updated successfully, but these errors were encountered: