soarcn/UndoBar

onHide() is not executed when UndoBar is cleared prematurely

jakis39 opened this issue · 8 comments

OnHide() is not called when a new UndoBar is created before a previous UndoBar has time to time out and execute OnHide().

For example, I have an UndoBar come up every time I swipe away a list item. If I swipe away one list item, an UndoBar appears. If I then swipe away another list item immediately after, not giving the first UndoBar time to time out and animate out, then the first UndoBar's onHide() is not executed, and a new UndoBar comes up for the second item swiped away, replacing the first.

If I swipe two items away, I need the onHide callback to run for both items. Is this the intended functionality?

Well, UndoBar currently do not maintain a message queue to keep all the request, so obviously current undobar can't fullfill your needs. I will consider to support this in next release, but no estimation yet.It would be welcome if you pull some requests.

Thanks, I plan to work around this by using a queue within my app. I may make a pull request in the future to address this feature.

In the meantime however, I would like to clear all UndoBars manually in my Fragment's onPause(). Is it possible to manually clear UndoBars? I have noticed the public clear() function, but I am unsure how to use it.

Thank you

Your PR is expected.

You can use .clear() to remove all undobars attach to current activity( always activity not fragment), and be aware that call clear() would not trigger onHide.

I was going to send a PR and I saw this. clear does not trigger onHide. in OnDestroy method in my Activity I use clear() function. After I navigate out this activity, the timeout occurs and hide function in UndoBar starts and it appears and disappears again.

I simply change clear function to hide all UndoBar's in that Activity. Is that wrong?

well, onHide will be triggered after calling clear() is a defect, will be fixed soon.
in addition to this, I will add a onhide interface in listener.
I will push those to master before tomorrow.

Damn I was going to update our application today. :) Thanks for the great
library btw
On Jun 11, 2014 2:50 PM, "Liao Kai" notifications@github.com wrote:

well, onHide will be triggered after calling clear() is a defect, will be
fixed soon.
in addition to this, I will add a onhide interface in listener.
I will push those to master before tomorrow.


Reply to this email directly or view it on GitHub
#20 (comment).

1.3 has been pushed with several defects fixing, will be available soon in maven central repository.

message queue has been supported from 1.6. bars will be shown one by one.