-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
ViewObservable.text()
does not work with Observable.delay()
#7
Comments
|
It was my mistake to make I think we should change the return type of |
I did a little bit more investigation into this and If you include an extra map to |
I think I was a little too optimistic when I wrote
ViewObservable.text()
to emit the view itself, because it doesn't capture any value in it's original state, which is problematic when using transformations like.delay()
. Here's one example:This block is attempting to find when the user has not typed a new character in a .5 second window, but it doesn't work because the
.map()
also gets delayed and the call toTextView.getText()
returns the most recently updated text, not the text .5 seconds ago. UsingViewObservable.input()
instead of the first two lines does work.My goal when I wrote ReactiveX/RxJava#1545 was to provide flexibility to get a
CharSequence
as opposed to just aString
fromViewObservable.input(TextView)
but I figured just emitting theTextView
itself was more flexible. This is likely problematic for lots of Rx operations where you want to emit immutable values, especially when they are shared across multiple threads.I tried looking at #5 but I'm not sure this works for all cases. I think it's probably good to have a different solution that captures the text change value immediately and also emits a
CharSequence
. Anyone have any suggestions on the best way to ideally avoid breaking changes?The text was updated successfully, but these errors were encountered: