Skip to content
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

onTouchEvent only called with MotionEvent.Action_Down #16

Open
mikef-dk opened this issue Sep 4, 2014 · 2 comments
Open

onTouchEvent only called with MotionEvent.Action_Down #16

mikef-dk opened this issue Sep 4, 2014 · 2 comments

Comments

@mikef-dk
Copy link

mikef-dk commented Sep 4, 2014

There's an error in the library right inside the onTouchEvent method. It always jumps into the else-clause, because of this the Button is always tinted with the darkened color.

Fix:
Change return super.onTouchEvent(event); to return true. This notifies the system that the event was handled and thus the method can retrieve the next Action. (Like MotionEvent.ActionUp)

@mikef-dk
Copy link
Author

mikef-dk commented Sep 5, 2014

Additional change that's needed:
Inside the if (event.getAction() == MotionEvent.ACTION_UP) clause, performClick() must be called. Otherwise setting an onClickListener won't work (onClick won't be called).

@rsicarelli
Copy link

Perfect, thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants