use of ca.etsmtl.applets.etsmobile.util.TrimestreComparator in project ETSMobile-Android2 by ApplETS.
the class TodayWidgetProvider method requestEventList.
/**
* Procédure déclenchant une requête additionnelle pour permettre la synchronisation de la liste
* d'événements et satisfaire la condition syncEventListEnded dans
* {@link ca.etsmtl.applets.etsmobile.util.HoraireManager#onRequestSuccess(Object)}
*
* @param listeDeSessions
*/
private void requestEventList(ListeDeSessions listeDeSessions) {
Trimestre derniereSession = Collections.max(listeDeSessions.liste, new TrimestreComparator());
DateTime dateDebut = new DateTime(derniereSession.dateDebut);
if (DateTime.now().isBefore(dateDebut)) {
dateDebut = DateTime.now();
}
DateTime dateEnd = new DateTime(derniereSession.dateFin);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateDebutFormatted = formatter.format(dateDebut.toDate());
String dateFinFormatted = formatter.format(dateEnd.toDate());
dataManager.start();
dataManager.sendRequest(new AppletsApiCalendarRequest(context, dateDebutFormatted, dateFinFormatted), this);
}
use of ca.etsmtl.applets.etsmobile.util.TrimestreComparator in project ETSMobile-Android2 by ApplETS.
the class HoraireFragment method onRequestSuccess.
@Override
public void onRequestSuccess(final Object o) {
if (o instanceof ListeDeSessions && !((ListeDeSessions) o).liste.isEmpty()) {
ListeDeSessions listeDeSessions = (ListeDeSessions) o;
Trimestre derniereSession = Collections.max(listeDeSessions.liste, new TrimestreComparator());
DateTime dateDebut = new DateTime(derniereSession.dateDebut);
if (DateTime.now().isBefore(dateDebut)) {
dateDebut = DateTime.now();
}
DateTime dateEnd = new DateTime(derniereSession.dateFin);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateDebutFormatted = formatter.format(dateDebut.toDate());
String dateFinFormatted = formatter.format(dateEnd.toDate());
dataManager.sendRequest(new AppletsApiCalendarRequest(getActivity(), dateDebutFormatted, dateFinFormatted), this);
}
horaireManager.onRequestSuccess(o);
}
Aggregations