use of ca.etsmtl.applets.etsmobile.model.Trimestre in project ETSMobile-Android2 by ApplETS.
the class NoteManager method getTrimestres.
public List<Trimestre> getTrimestres() {
DatabaseHelper dbHelper = new DatabaseHelper(context);
List<Trimestre> trimestresList = null;
try {
trimestresList = dbHelper.getDao(Trimestre.class).queryForAll();
} catch (SQLException e) {
Log.e("SQL Exception", e.getMessage());
}
return trimestresList;
}
use of ca.etsmtl.applets.etsmobile.model.Trimestre in project ETSMobile-Android2 by ApplETS.
the class TodayFragment method onRequestSuccess.
@Override
public void onRequestSuccess(Object o) {
if (o instanceof ListeDeSessions && ((ListeDeSessions) o).liste.size() > 0) {
ListeDeSessions listeDeSessions = (ListeDeSessions) o;
Date currentDate = new Date();
Date dateStart = new Date();
Date dateEnd = new Date();
Collections.sort(listeDeSessions.liste, new Comparator<Trimestre>() {
@Override
public int compare(Trimestre t1, Trimestre t2) {
Date dateT1 = Utility.getDateFromString(t1.dateDebut);
Date dateT2 = Utility.getDateFromString(t2.dateDebut);
return dateT2.compareTo(dateT1);
}
});
Trimestre trimestre = null;
// Obtention de la session précédente
if (listeDeSessions.liste.size() > 1) {
trimestre = listeDeSessions.liste.get(1);
dateStart = Utility.getDateFromString(trimestre.dateDebut);
dateEnd = Utility.getDateFromString(trimestre.dateFin);
}
// Si la session précédente est cours...
if (isAdded() && trimestre != null && currentDate.after(dateStart) && currentDate.before(dateEnd)) {
saveSemesterProgressBarDatesToPrefs(trimestre.dateDebut, trimestre.dateFin);
setSemesterProgressBarText(dateStart, dateEnd);
} else {
trimestre = listeDeSessions.liste.get(0);
dateStart = Utility.getDateFromString(trimestre.dateDebut);
dateEnd = Utility.getDateFromString(trimestre.dateFin);
saveSemesterProgressBarDatesToPrefs(trimestre.dateDebut, trimestre.dateFin);
setSemesterProgressBarText(dateStart, dateEnd);
}
} else {
horaireManager.onRequestSuccess(o);
}
}
Aggregations