Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not observing the NetworkBoundResource to update the UI #1

Open
vivekpanchal opened this issue Mar 13, 2020 · 0 comments
Open

Not observing the NetworkBoundResource to update the UI #1

vivekpanchal opened this issue Mar 13, 2020 · 0 comments

Comments

@vivekpanchal
Copy link

i would like to know that how to observe the changes in the mainActivity ..ie
like when network call is made and failed then how do you observe those changes
and you are not using the NetworkboundResource to update the UI like this ...


`if (listResource.data != null) {
                        switch (listResource.status) {
                            case LOADING: {
//                                if(mRecipeListViewModel.getPageNumber() > 1){
//                                    mAdapter.displayLoading();
//                                }
//                                else{
//                                    mAdapter.displayOnlyLoading();
//                                }
//                                break;
                            }

                            case ERROR: {
                                Timber.e("onChanged: cannot refresh the cache.");
                                Timber.e("onChanged: ERROR message: %s", listResource.message);
                                Timber.e("onChanged: status: ERROR, #recipes: %s", listResource.data.size());
//                                mAdapter.hideLoading();
//                                mAdapter.setRecipes(listResource.data);
//                                Toast.makeText(RecipeListActivity.this, listResource.message, Toast.LENGTH_SHORT).show();
//
//                                if(listResource.message.equals(QUERY_EXHAUSTED)){
//                                    mAdapter.setQueryExhausted();
//                                }
//                                break;
                            }

                            case SUCCESS: {
                                Timber.d("onChanged: cache has been refreshed.");
                                Timber.d("onChanged: status: SUCCESS, #Recipes: %s", listResource.data.size());
//                                mAdapter.hideLoading();
//                                mAdapter.setRecipes(listResource.data);
                                break;
                            }`

kindly help me understand as I don't see that you are using anywhere the Resource Generic to handle the UI updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant