diff --git a/domain/src/main/java/saulmm/avengers/GetCharactersUsecase.java b/domain/src/main/java/saulmm/avengers/GetCharactersUsecase.java index b122adc..63a1843 100644 --- a/domain/src/main/java/saulmm/avengers/GetCharactersUsecase.java +++ b/domain/src/main/java/saulmm/avengers/GetCharactersUsecase.java @@ -15,22 +15,23 @@ public class GetCharactersUsecase extends Usecase> { private final CharacterRepository mRepository; private int mCurrentOffset; - Scheduler uiThread, executorThread; + private final Scheduler mUiThread; + private final Scheduler mExecutorThread; @Inject public GetCharactersUsecase(CharacterRepository repository, @Named("ui_thread") Scheduler uiThread, @Named("executor_thread") Scheduler executorThread) { mRepository = repository; - this.uiThread = uiThread; - this.executorThread = executorThread; + mUiThread = uiThread; + mExecutorThread = executorThread; } @Override public Observable> buildObservable() { return mRepository.getCharacters(mCurrentOffset) - .observeOn(uiThread) - .subscribeOn(executorThread) + .observeOn(mUiThread) + .subscribeOn(mExecutorThread) .doOnError(new Action1() { @Override public void call(Throwable throwable) { diff --git a/model/src/main/java/saulmm/avengers/rest/RestDataSource.java b/model/src/main/java/saulmm/avengers/rest/RestDataSource.java index 9bbee93..acf5b6d 100644 --- a/model/src/main/java/saulmm/avengers/rest/RestDataSource.java +++ b/model/src/main/java/saulmm/avengers/rest/RestDataSource.java @@ -18,6 +18,7 @@ import retrofit.Retrofit; import retrofit.RxJavaCallAdapterFactory; import rx.Observable; +import rx.functions.Action1; import rx.functions.Func1; import saulmm.avengers.entities.CollectionItem; import saulmm.avengers.entities.MarvelCharacter; @@ -78,13 +79,12 @@ public RestDataSource(MarvelAuthorizer marvelAuthorizer) { @Override public Observable getCharacter(final int characterId) { - return mMarvelApi.getCharacterById(characterId) - .flatMap(new Func1, Observable>() { + return mMarvelApi.getCharacterById(characterId) + .flatMap(new Func1, Observable>() { @Override public Observable call(List characters) { return Observable.just(characters.get(0)); } }); - } @Override