use of ca.etsmtl.applets.etsmobile.util.HoraireComparator in project ETSMobile-Android2 by ApplETS.
the class SeanceAdapter method setItemList.
public void setItemList(List<Seances> itemListSeance, List<Event> itemListEvent) {
listSeances = new ArrayList<>();
ArrayList<IHoraireRows> listRowItems = new ArrayList<IHoraireRows>();
String tempDate = "";
DateTime today = new DateTime();
listRowItems.addAll(itemListEvent);
listRowItems.addAll(itemListSeance);
Collections.sort(listRowItems, new HoraireComparator());
for (IHoraireRows rows : listRowItems) {
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
DateTime seanceDay = formatter.parseDateTime(rows.getDateDebut().substring(0, 10));
if (!rows.getDateDebut().substring(0, 10).equals(tempDate)) {
tempDate = rows.getDateDebut().substring(0, 10);
DateTime.Property pDoW = seanceDay.dayOfWeek();
DateTime.Property pDoM = seanceDay.dayOfMonth();
DateTime.Property pMoY = seanceDay.monthOfYear();
this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_TITLE_SEANCE, context.getString(R.string.date_text, pDoW.getAsText(Locale.getDefault()), pDoM.get(), pMoY.getAsText(Locale.getDefault()))));
}
if (rows.getClass().equals(Event.class)) {
this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_ETS_EVENT, rows));
} else if (rows.getClass().equals(Seances.class)) {
this.listSeances.add(new TodayDataRowItem(TodayDataRowItem.viewType.VIEW_TYPE_SEANCE, rows));
}
}
}
Aggregations