Skip to content

Commit

Permalink
refactor: ♻️ remove ReplaceToVoid
Browse files Browse the repository at this point in the history
use Replacements.returnVoid()

closes #2
  • Loading branch information
ffgiraldez committed Apr 9, 2018
1 parent ddf2ad7 commit c701640
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
26 changes: 0 additions & 26 deletions app/src/main/java/es/ffgiraldez/comicsearch/ReplaceToVoid.java

This file was deleted.

10 changes: 10 additions & 0 deletions app/src/main/java/es/ffgiraldez/comicsearch/rx/Replacements.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package es.ffgiraldez.comicsearch.rx;

import es.ffgiraldez.comicsearch.ReplaceToVoid;
import rx.functions.Func1;

public class Replacements {
public static Func1<Object, Void> returnVoid() {
return new ReplaceToVoid();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import java.util.List;

import es.ffgiraldez.comicsearch.ReplaceToVoid;
import es.ffgiraldez.comicsearch.data.ComicStorage;
import es.ffgiraldez.comicsearch.model.SearchResult;
import es.ffgiraldez.comicsearch.rx.Replacements;
import es.ffgiraldez.comicsearch.search.domain.FetchSearchResultTransformer;
import rx.Observable;

Expand All @@ -40,7 +40,7 @@ public void initialize() {

subscribe(Property.RESULTS, fetchResultObservable);
Observable<List<String>> resultsObservable = observe(Property.RESULTS);
updatedResultsObservable = resultsObservable.map(new ReplaceToVoid<List<String>>());
updatedResultsObservable = resultsObservable.map(Replacements.returnVoid());
}

public Observable<Void> didUpdateResults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import es.ffgiraldez.comicsearch.ReplaceToVoid;
import es.ffgiraldez.comicsearch.data.ComicStorage;
import es.ffgiraldez.comicsearch.rx.Replacements;
import es.ffgiraldez.comicsearch.sugestion.domain.FetchQueryTransformer;
import rx.Observable;

Expand All @@ -32,6 +32,7 @@ public class SuggestionViewModel extends ObservableSuggestionViewModel {
public SuggestionViewModel(ComicStorage comicStorage) {
this.comicStorage = comicStorage;
}

@Override
public void initialize() {
Observable<String> input = this.<String>observe(Property.QUERY)
Expand All @@ -42,7 +43,7 @@ public void initialize() {
subscribe(Property.SUGGESTIONS, suggestionObservable);

Observable<List<String>> suggestionPropObservable = observe(Property.SUGGESTIONS);
updatedSuggestionsObservable = suggestionPropObservable.map(new ReplaceToVoid<List<String>>());
updatedSuggestionsObservable = suggestionPropObservable.map(Replacements.returnVoid());
}

public Observable<Void> didUpdateSuggestion() {
Expand Down

0 comments on commit c701640

Please sign in to comment.