use of ca.etsmtl.applets.etsmobile.http.AppletsApiSourcesRequest in project ETSMobile-Android2 by ApplETS.
the class EventsFragment method onResume.
@Override
public void onResume() {
super.onResume();
expandableListAdapter.clearEvents();
progressBar.setVisibility(View.VISIBLE);
countSourcesLoaded = 0;
nbSources = 0;
progressBar.setProgress(0);
AppletsApiSourcesRequest requestSources = new AppletsApiSourcesRequest(getActivity());
String cacheKey = requestSources.createCacheKey();
spiceManager.execute(requestSources, cacheKey, DurationInMillis.ONE_MINUTE * 10, new RequestListener<SourceEvenementList>() {
@Override
public void onRequestFailure(SpiceException spiceException) {
spiceException.printStackTrace();
Toast.makeText(getActivity(), getString(R.string.SupportKit_errorCouldNotConnect), Toast.LENGTH_SHORT).show();
}
@Override
public void onRequestSuccess(SourceEvenementList sourceEvenements) {
progressBar.setMax(sourceEvenements.size());
EventsFragment.this.nbSources = sourceEvenements.size();
for (SourceEvenement source : sourceEvenements) {
AppletsApiEvenementsRequest requestEvents = new AppletsApiEvenementsRequest(getActivity(), source);
String cacheKey = requestEvents.createCacheKey();
spiceManager.execute(requestEvents, cacheKey, DurationInMillis.ONE_MINUTE * 10, EventsFragment.this);
}
}
});
}
Aggregations