I am using MVVM pattern with repository for network call.
When i click button in my view it triggers save/ fetch data method in my viewmodel which then make call to repository wherein i am doing my network operation using Retrofit.
Now i would like to dismiss my progress bar with proper message (like saved, error etc. from my repository (onResponse or onFailure) that i started inside view.
public void onClick(View v) {
ProgressDialog dialog = new ProgressDialog(getActivity());
dialog.setMessage("saving...");
dialog.show();
cuttingUnitViewModel.saveProjectUnit();
}
Is it ok to do what i am doing or is there better alternative?
All i want to say that I want to return NETWORK STATE and DATA both from repository , how to do that?