Skip to content

Some trivial cleanup #61

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 2 commits into from
Nov 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ private AndroidObservable() {

/**
* Binds the given source sequence to an activity.
* <p/>
* <p>
* This helper will schedule the given sequence to be observed on the main UI thread and ensure
* that no notifications will be forwarded to the activity in case it is scheduled to finish.
* <p/>
* <p>
* You should unsubscribe from the returned Observable in onDestroy at the latest, in order to not
* leak the activity or an inner subscriber. Conversely, when the source sequence can outlive the activity,
* make sure to bind to new instances of the activity again, e.g. after going through configuration changes.
Expand All @@ -87,16 +87,16 @@ private AndroidObservable() {
*/
public static <T> Observable<T> bindActivity(Activity activity, Observable<T> source) {
Assertions.assertUiThread();
return source.observeOn(mainThread()).lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR));
return source.lift(new OperatorConditionalBinding<T, Activity>(activity, ACTIVITY_VALIDATOR)).observeOn(mainThread());
}

/**
* Binds the given source sequence to a fragment (native or support-v4).
* <p/>
* <p>
* This helper will schedule the given sequence to be observed on the main UI thread and ensure
* that no notifications will be forwarded to the fragment in case it gets detached from its
* activity or the activity is scheduled to finish.
* <p/>
* <p>
* You should unsubscribe from the returned Observable in onDestroy for normal fragments, or in onDestroyView
* for retained fragments, in order to not leak any references to the host activity or the fragment.
* Refer to the samples project for actual examples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Ties a source sequence to the given target object using a predicate. If the predicate fails
* to validate, the sequence unsubscribes itself and releases the bound reference.
* <p/>
* <p>
* You can also pass in an optional predicate function, which whenever it evaluates to false
* on the target object, will also result in the operator unsubscribing from the sequence.
*
Expand Down