@Override protected Void doInBackground(Void... params) { Client.INSTANCE.sendService( MkShop.AUTH, service, new Callback<String>() { @Override public void success(String s, Response response) { if (dialog != null && dialog.isShowing()) dialog.dismiss(); MkShop.toast(getActivity(), s); Fragment fragment = new RequestRepair(); getFragmentManager().beginTransaction().replace(R.id.container, fragment).commit(); } @Override public void failure(RetrofitError error) { if (dialog != null && dialog.isShowing()) dialog.dismiss(); if (error.getKind().equals(RetrofitError.Kind.NETWORK)) MkShop.toast(getActivity(), "please check your internet connection"); else MkShop.toast(getActivity(), error.getMessage()); } }); return null; }
private void executequery() { materialDialog.show(); Client.INSTANCE.getServiceReport( MkShop.AUTH, sFromDate, sToDate, new Callback<List<ServiceCenterEntity>>() { @Override public void success(final List<ServiceCenterEntity> serviceList, Response response) { Myenum.INSTANCE.setServiceList(serviceList); if (materialDialog != null && materialDialog.isShowing()) materialDialog.dismiss(); tabLayout.setTabsFromPagerAdapter(adapter); viewPager.setAdapter(adapter); } @Override public void failure(RetrofitError error) { if (materialDialog != null && materialDialog.isShowing()) materialDialog.dismiss(); MkShop.toast(getActivity(), error.getMessage()); } }); }