8000 Refactoring OperatorViewDetachedFromWindowFirst by dpsm · Pull Request #70 · ReactiveX/RxAndroid · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactoring OperatorViewDetachedFromWindowFirst #70

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

Merged
merged 3 commits into from
Nov 24, 2014
Merged

Conversation

dpsm
Copy link
Contributor
@dpsm dpsm commented Nov 21, 2014
  1. Renaming to OnSubscribeViewDetachedFromWindowFirst.java
  2. Adding tests to assert the desired behaviour
  3. Refactoring to avoid the "instantiate and forget" approach
    within OnSubscribe.call(..)

Signed-off-by: David Marques dpsmarques@gmail.com

@dpsm
Copy link
Contributor Author
dpsm commented Nov 21, 2014

CC @mttkay @JakeWharton

@dlew
Copy link
Collaborator
dlew commented Nov 21, 2014

I was wondering this when I was working on similar operators today - why all the extra effort to clear out the internal SubscriptionAdapter if this class is used only with takeUntil() in order to complete a sequence?

@omo
Copy link
Contributor
omo commented Nov 21, 2014

@dlew It might be a bit overkill as SubscriptionAdapter#isUnsubscribed() is never called from outside.
I did so just because I felt bad about just returning a bogus value there.
This refactoring LGTM btw.

@dpsm
Copy link
Contributor Author
dpsm commented Nov 21, 2014

@dlew I assume you are referring to the view = null part of the clear (the listener part is obviously needed).

Well, The issue is that the downstream subscriber life-span is unpredictable and since we add ourselves ad child subscriptions it will hold us and the View we reference for an "indeterministic" time. It's more like a safeguard.

@JakeWharton
Copy link
Contributor

This will need a rebase now.

1. Renaming to OnSubscribeViewDetachedFromWindowFirst.java
2. Adding tests to assert the desired behaviour
3. Refactoring to avoid the "instantiate and forget" approach
within OnSubscribe.call(..)

Signed-off-by: David Marques <dpsmarques@gmail.com>
Moving OnSubscribeViewDetachedFromWindowFirstTest.java to the right
package so the test can access the target class.

Signed-off-by: David Marques <dpsmarques@gmail.com>
@dpsm
Copy link
Contributor Author
dpsm commented Nov 22, 2014

@JakeWharton @mttkay rebased.

@@ -20,32 +20,33 @@
import rx.Subscription;

/**
* An internal class that is used from #{@link ViewObservable#bindView}.
* An internal class that is used from #{@link rx.android.view.ViewObservable#bindView}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert. This is in the same package and doesn't need qualified. If you are using IntelliJ there's a setting to turn off this behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this first sentence isn't useful and can just be deleted.

Signed-off-by: David Marques <dpsmarques@gmail.com>
@hamidp
Copy link
Contributor
hamidp commented Nov 24, 2014

👍 Thank you!

@dpsm
Copy link
Contributor Author
dpsm commented Nov 24, 2014

@JakeWharton @mttkay please take a look once you have a chance.

@mttkay
Copy link
Collaborator
mttkay commented Nov 24, 2014

👍

JakeWharton added a commit that referenced this pull request Nov 24, 2014
Refactoring OperatorViewDetachedFromWindowFirst
@JakeWharton JakeWharton merged commit b232482 into ReactiveX:0.x Nov 24, 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.

6 participants
0