GitHub - pbednarz/BaseAndroidProject: Basic project using the new AppCompat, Retrofit, OrmLite and RxJava for async operations. · GitHub
Skip to content

pbednarz/BaseAndroidProject

Repository files navigation

BaseProject

Fetching and saving API data using Retrifit Observable (RxJava) and OrmLite:

private void loadAlbum() {
    refreshLayout.setRefreshing(true);
    retrofitSubscription = AppObservable.bindFragment(this, Service.getInstance(getActivity())
            .getNewClientInstance().getAlbum(getArguments().getString(ALBUM_NAME_KEY))
            .doOnNext(album -> DatabaseManager.getInstance(getActivity().getApplicationContext())
                    .saveAlbum(album))
            .subscribeOn(Schedulers.io()))
            .subscribe(album -> {
                        mAdapter.setAlbum(album);
                        mAdapter.notifyDataSetChanged();
                    },
                    exception -> {
                        exception.printStackTrace();
                        refreshLayout.setRefreshing(false);
                    }, () -> refreshLayout.setRefreshing(false));
}

License

Apache License 2.0

About

Basic project using the new AppCompat, Retrofit, OrmLite and RxJava for async operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages