Skip to content

Instantly share code, notes, and snippets.

@PierceZ
Created October 4, 2017 15:18
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 PierceZ/5e716b9fd66abbc21e7be57dec75e98d to your computer and use it in GitHub Desktop.
Save PierceZ/5e716b9fd66abbc21e7be57dec75e98d to your computer and use it in GitHub Desktop.
...
ZooFragmentViewModel viewModel = ViewModelProviders.of(this).get(ZooFragmentViewModel.class);
viewModel.getZooUpdateResponse().observe(this, response -> {
if (response != null) {
switch (response.getStatus()) {
case Response.STATUS_LOADING:
showProgressBar(true);
break;
case Response.STATUS_SUCCESS:
dismiss();
break;
case Response.STATUS_FAIL:
showProgressBar(false);
Toast.makeText(getContext(), response.getErrorMessage(), Toast.LENGTH_SHORT).show();
break;
}
}
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment