File tree Expand file tree Collapse file tree 1 file changed +1
-30
lines changed
app/src/main/java/com/codingwithmitch/rxjavaflatmapexample Expand file tree Collapse file tree 1 file changed +1
-30
lines changed Original file line number Diff line number Diff line change @@ -90,36 +90,7 @@ public ObservableSource<Post> apply(final List<Post> posts) throws Exception {
9090 }
9191
9292 private void updatePost (final Post p ){
93- Observable
94- .fromIterable (adapter .getPosts ())
95- .filter (new Predicate <Post >() {
96- @ Override
97- public boolean test (Post post ) throws Exception {
98- return post .getId () == p .getId ();
99- }
100- })
101- .observeOn (AndroidSchedulers .mainThread ())
102- .subscribe (new Observer <Post >() {
103- @ Override
104- public void onSubscribe (Disposable d ) {
105- disposables .add (d );
106- }
107-
108- @ Override
109- public void onNext (Post post ) {
110- Log .d (TAG , "onNext: updating post: " + post .getId () + ", thread: " + Thread .currentThread ().getName ());
111- adapter .updatePost (post );
112- }
113-
114- @ Override
115- public void onError (Throwable e ) {
116- Log .e (TAG , "onError: " , e );
117- }
118-
119- @ Override
120- public void onComplete () {
121- }
122- });
93+ adapter .updatePost (post );
12394 }
12495
12596 private Observable <Post > getCommentsObservable (final Post post ){
You can’t perform that action at this time.
0 commit comments