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

Add ViewObservables.listViewScroll(AbsListView). #57

Merged
merged 1 commit into from
Nov 20, 2014

Conversation

hamidp
Copy link
Contributor

@hamidp hamidp commented Nov 18, 2014

No description provided.


import android.widget.AbsListView;

public class OnListViewScrollEvent {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole class can be replaced with auto/value. The best code is the code you neither write nor have to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Didn't know about that. From what I can tell auto is not a dependency in RxAndroid yet and that seems like a wider discussion of tooling, style, and personal preferences.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no runtime component. It's entirely an implementation detail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i.e., it's a build-time only dependency)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeWharton is it cool with you if we do that in a separate step? We can log an issue to add auto support to remove boiler plate like this and then port things over.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, definitely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added #63

@hamidp
Copy link
Contributor Author

hamidp commented Nov 20, 2014

All of the comments should be addressed now. I've also squashed an rebased.

};

composite.addOnScrollListener(listener);
observer.add(AndroidSubscriptions.unsubscribeInUiThread(new Action0() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always thought these double dispatches are weird. We're already testing as a precondition that we're on the main thread, so unless we're rescheduling the observable purposefully to deliver notifications on a background thread after this operator is applied, we will also unsubscribe on the main thread.

I've seen this being done a lot in the last few PRs and always wondered if we're just being defensive or if this will not simply cause an extra cycle through the message loop in the normal case, thus unnecessarily delaying unsubscription?

@mttkay
Copy link
Collaborator

mttkay commented Nov 20, 2014

👍

@hamidp
Copy link
Contributor Author

hamidp commented Nov 20, 2014

I don't have write access so can someone with write merge when it all looks good?

JakeWharton added a commit that referenced this pull request Nov 20, 2014
Add ViewObservables.listViewScroll(AbsListView).
@JakeWharton JakeWharton merged commit 769917c into ReactiveX:0.x Nov 20, 2014
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

Successfully merging this pull request may close these issues.

None yet

4 participants