use of net.fortuna.ical4j.model.property.DtStamp in project android by nextcloud.
the class SaveCalendar method getEvents.
private List<VEvent> getEvents(ContentResolver resolver, AndroidCalendar cal_src, Calendar cal_dst) {
String where = Events.CALENDAR_ID + "=?";
String[] args = new String[] { cal_src.mIdStr };
String sortBy = Events.CALENDAR_ID + " ASC";
Cursor cur;
try {
cur = resolver.query(Events.CONTENT_URI, mAllCols ? null : EVENT_COLS, where, args, sortBy);
} catch (Exception except) {
Log_OC.w(TAG, "Calendar provider is missing columns, continuing anyway");
int n = 0;
for (n = 0; n < EVENT_COLS.length; ++n) {
if (EVENT_COLS[n] == null) {
Log_OC.e(TAG, "Invalid EVENT_COLS index " + Integer.toString(n));
}
}
cur = resolver.query(Events.CONTENT_URI, null, where, args, sortBy);
}
// Same timestamp for all events
DtStamp timestamp = new DtStamp();
// Collect up events and add them after any timezones
List<VEvent> events = new ArrayList<>();
while (cur.moveToNext()) {
VEvent e = convertFromDb(cur, cal_dst, timestamp);
if (e != null) {
events.add(e);
Log_OC.d(TAG, "Adding event: " + e.toString());
}
}
cur.close();
return events;
}
Aggregations