Skip to content

Instantly share code, notes, and snippets.

@iammert
Last active July 11, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iammert/bd252b962b1fdebb7a4a39f91082f7b2 to your computer and use it in GitHub Desktop.
Save iammert/bd252b962b1fdebb7a4a39f91082f7b2 to your computer and use it in GitHub Desktop.
GenresViewModel.java
public class GenresViewModel extends ViewModel {
private LiveData<Resource<List<GenreEntity>>> genreLiveData;
@Inject
public GenresViewModel(RadioRepository radioRepository) {
genreLiveData = LiveDataReactiveStreams.fromPublisher(radioRepository.getGenres()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()));
}
public LiveData<Resource<List<GenreEntity>>> getGenres() {
return genreLiveData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment