@OnClick(R.id.register)
void click() {
openFragment(new RegisterFragment(), R.id.main_container);
}
I use this for a view click event. when i click quickly. it open two fragment.it seem that DebouncingOnClickListener enabled variables doesn't work.
It only debounces two clicks on one frame. If you click twice on two separate frames then that's the responsibility of the application layer to handle. You can fix this by disabling the button on the first click.
Does it makes sense to add an option to specify debounce interval in the annotation like@OnClick(id, debounceInterval=1000)? In my current application i've been adding additional logic to avoid this issue.
That also sounds like an application-layer concern that I'd be very
hesitant about adding.
On Tue, May 24, 2016 at 4:13 AM leesocrates [email protected]
wrote:
@OnClick(R.id.register)
void click() {
openFragment(new RegisterFragment(), R.id.main_container);
}I use this for a view click event. when i click quickly. it open two
fragment.it seem that DebouncingOnClickListener enabled variables doesn't
work.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/JakeWharton/butterknife/issues/590
Does it makes sense to add an option to specify debounce interval in the annotation like@OnClick(id, debounceInterval=1000)? In my current application i've been adding additional logic to avoid this issue.
A not very good solution is:
create a same class as that in butterknife: butterknife.internal.DebouncingOnClickListener in your project, and just modify the follow code:
from v.post(ENABLE_AGAIN); to v.postDelayed(ENABLE_AGAIN, 300);
then the button can just be clicked only once in 300ms.
Most helpful comment
Does it makes sense to add an option to specify debounce interval in the annotation like@OnClick(id, debounceInterval=1000)? In my current application i've been adding additional logic to avoid this issue.