diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1c84c40f..ec38eeec 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -16,6 +16,7 @@
+
calendarEventList = new ArrayList();
+
+ public List getCalendarEventList(Context mContext) {
+ fetchSystemEvents(mContext);
+ return calendarEventList;
+ }
+
+ private boolean fetchSystemEvents(Context mContext) {
+
+ Calendar cal = GregorianCalendar.getInstance();
+ Long dtStart = cal.getTime().getTime();
+ cal.add(Calendar.DATE, lookahead_days);
+ Long dtEnd = cal.getTime().getTime();
+
+ Uri.Builder eventsUriBuilder = CalendarContract.Instances.CONTENT_URI.buildUpon();
+ ContentUris.appendId(eventsUriBuilder, dtStart);
+ ContentUris.appendId(eventsUriBuilder, dtEnd);
+ Uri eventsUri = eventsUriBuilder.build();
+
+ Cursor evtCursor = null;
+ evtCursor = mContext.getContentResolver().query(eventsUri, EVENT_INSTANCE_PROJECTION, null, null, CalendarContract.Instances.DTSTART + " ASC");
+
+ if (evtCursor.moveToFirst()) {
+ do {
+ CalendarEvent calEvent = new CalendarEvent(
+ evtCursor.getLong(1),
+ evtCursor.getLong(2),
+ evtCursor.getLong(3),
+ evtCursor.getString(4),
+ evtCursor.getString(5),
+ evtCursor.getString(6),
+ evtCursor.getString(7)
+ );
+ calendarEventList.add(calEvent);
+ } while(evtCursor.moveToNext());
+
+ return true;
+ }
+ return false;
+ }
+
+ public class CalendarEvent {
+ private long begin;
+ private long end;
+ private long id;
+ private String title;
+ private String description;
+ private String location;
+ private String calName;
+
+ public CalendarEvent(long begin, long end, long id, String title, String description, String location, String calName) {
+ this.begin = begin;
+ this.end = end;
+ this.id = id;
+ this.title = title;
+ this.description = description;
+ this.location = location;
+ this.calName = calName;
+ }
+
+ public long getBegin() {
+ return begin;
+ }
+
+ public long getEnd() {
+ return end;
+ }
+
+ public long getDuration() {
+ return end - begin;
+ }
+
+
+ public long getId() {
+ return id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getCalName() {
+ return calName;
+ }
+
+ }
+}