We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There is currently only an implementation to subscribe to click events. I'd like to observe touch events from the View.OnTouchListener.
View.OnTouchListener
I already implemented it https://gist.github.com/passsy/96f3e268f53a315ba7df
Sample usecase: show/hide a password depending on the pressed state of a button
ViewObservable.bindView(mPasswordShowBtn, touches(mPasswordShowBtn)) .map(new Func1<OnTouchEvent, Boolean>() { @Override public Boolean call(final OnTouchEvent onTouchEvent) { return isTouchingEvent(onTouchEvent.event()); } }) .distinctUntilChanged() .subscribe(new Action1<Boolean>() { @Override public void call(final Boolean touched) { mPassword.setTransformationMethod(touched ? null : new PasswordTransformationMethod()); } });
private static boolean isTouchingEvent(final MotionEvent event) { final int action = event.getAction() & MotionEvent.ACTION_MASK; switch (action) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: return true; default: case MotionEvent.ACTION_OUTSIDE: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: return false; } } public static Observable<OnTouchEvent> touches(final View view) { return Observable.create(new OnSubscribeViewTouch(view)); }
I try to fit the contributing guidelines once I get feedback if this is something that should be added to RxAndroid.
The text was updated successfully, but these errors were encountered:
This is already in https://github.com/JakeWharton/RxBinding but per #172 this won't be going into RxAndroid core.
Sorry, something went wrong.
No branches or pull requests
There is currently only an implementation to subscribe to click events. I'd like to observe touch events from the
View.OnTouchListener
.I already implemented it
https://gist.github.com/passsy/96f3e268f53a315ba7df
Sample usecase: show/hide a password depending on the pressed state of a button
I try to fit the contributing guidelines once I get feedback if this is something that should be added to RxAndroid.
The text was updated successfully, but these errors were encountered: