-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Conversation
I was wondering this when I was working on similar operators today - why all the extra effort to clear out the internal |
@dlew It might be a bit overkill as SubscriptionAdapter#isUnsubscribed() is never called from outside. |
@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. |
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>
@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}. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
👍 Thank you! |
@JakeWharton @mttkay please take a look once you have a chance. |
👍 |
Refactoring OperatorViewDetachedFromWindowFirst
within OnSubscribe.call(..)
Signed-off-by: David Marques dpsmarques@gmail.com