Last active
August 29, 2015 14:20
-
-
Save defHLT/055ad3e101f8632ef9ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onAttach(final Activity activity) { | |
super.onAttach(activity); | |
mContextStream.onNext(activity); | |
} | |
// ...... | |
rx.Observable.combineLatest(mResultObservable, | |
// Activity | |
mContextStream.filter(new Func1<Activity, Boolean>() { | |
@Override | |
public Boolean call(Activity activity) { | |
return activity != null; | |
} | |
}), | |
// Combine | |
new Func2<ContentValues[], Activity, Pair<ContentValues[], Activity>>() { | |
@Override | |
public Pair<ContentValues[], Activity> call(ContentValues[] values, Activity a) { | |
return new Pair<>(values, a); | |
} | |
} | |
).subscribe(new Action1<Pair<ContentValues[], Activity>>() { | |
@Override | |
public void call(Pair<ContentValues[], Activity> pair) { | |
pair.second.getContentResolver().bulkInsert( | |
DbContract.SearchEntry.SEARCH_URI, | |
pair.first); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment