Skip to content

Commit c701640

Browse files
committed
refactor: ♻️ remove ReplaceToVoid
use Replacements.returnVoid() closes #2
1 parent ddf2ad7 commit c701640

File tree

4 files changed

+15
-30
lines changed

4 files changed

+15
-30
lines changed

app/src/main/java/es/ffgiraldez/comicsearch/ReplaceToVoid.java

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package es.ffgiraldez.comicsearch.rx;
2+
3+
import es.ffgiraldez.comicsearch.ReplaceToVoid;
4+
import rx.functions.Func1;
5+
6+
public class Replacements {
7+
public static Func1<Object, Void> returnVoid() {
8+
return new ReplaceToVoid();
9+
}
10+
}

app/src/main/java/es/ffgiraldez/comicsearch/search/presentation/SearchViewModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
import java.util.List;
2020

21-
import es.ffgiraldez.comicsearch.ReplaceToVoid;
2221
import es.ffgiraldez.comicsearch.data.ComicStorage;
2322
import es.ffgiraldez.comicsearch.model.SearchResult;
23+
import es.ffgiraldez.comicsearch.rx.Replacements;
2424
import es.ffgiraldez.comicsearch.search.domain.FetchSearchResultTransformer;
2525
import rx.Observable;
2626

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

4141
subscribe(Property.RESULTS, fetchResultObservable);
4242
Observable<List<String>> resultsObservable = observe(Property.RESULTS);
43-
updatedResultsObservable = resultsObservable.map(new ReplaceToVoid<List<String>>());
43+
updatedResultsObservable = resultsObservable.map(Replacements.returnVoid());
4444
}
4545

4646
public Observable<Void> didUpdateResults() {

app/src/main/java/es/ffgiraldez/comicsearch/sugestion/presentation/SuggestionViewModel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.util.List;
2020
import java.util.concurrent.TimeUnit;
2121

22-
import es.ffgiraldez.comicsearch.ReplaceToVoid;
2322
import es.ffgiraldez.comicsearch.data.ComicStorage;
23+
import es.ffgiraldez.comicsearch.rx.Replacements;
2424
import es.ffgiraldez.comicsearch.sugestion.domain.FetchQueryTransformer;
2525
import rx.Observable;
2626

@@ -32,6 +32,7 @@ public class SuggestionViewModel extends ObservableSuggestionViewModel {
3232
public SuggestionViewModel(ComicStorage comicStorage) {
3333
this.comicStorage = comicStorage;
3434
}
35+
3536
@Override
3637
public void initialize() {
3738
Observable<String> input = this.<String>observe(Property.QUERY)
@@ -42,7 +43,7 @@ public void initialize() {
4243
subscribe(Property.SUGGESTIONS, suggestionObservable);
4344

4445
Observable<List<String>> suggestionPropObservable = observe(Property.SUGGESTIONS);
45-
updatedSuggestionsObservable = suggestionPropObservable.map(new ReplaceToVoid<List<String>>());
46+
updatedSuggestionsObservable = suggestionPropObservable.map(Replacements.returnVoid());
4647
}
4748

4849
public Observable<Void> didUpdateSuggestion() {

0 commit comments

Comments
 (0)