1. Afriza N. Arief
  2. muis_insert_missing_prayer_times

Commits

Afriza N. Arief  committed 15cce83

Minor tidy up

  • Participants
  • Parent commits d767a4b
  • Branches default

Comments (0)

Files changed (2)

File calendar-cmdline-sample/src/main/java/cc/co/abuaasiya/muis/BatchInsertPrayerTimes.java

View file
 package cc.co.abuaasiya.muis;
 
 import com.google.api.client.http.HttpStatusCodes;
-import com.google.api.client.util.DateTime;
 import com.google.api.services.calendar.Calendar;
 import com.google.api.services.calendar.CalendarClient;
 import com.google.api.services.calendar.CalendarUrl;
     try {
       Event event = new Event();
       event.setSummary(pt.name);
-      event.setStart(new EventDateTime().setDateTime(new DateTime(pt.calendar.getTime(),
-          pt.calendar.getTimeZone())));
+      event.setStart(pt.getEventDateTime());
       event.setEnd(new EventDateTime().setDateTime(event.getStart().getDateTime()));
       event = service.events().insert(calendarId, event).execute();
       System.out.println("-> " + event.getId());

File calendar-cmdline-sample/src/main/java/cc/co/abuaasiya/muis/PrayerTime.java

View file
 
 package cc.co.abuaasiya.muis;
 
+import com.google.api.client.util.DateTime;
+import com.google.api.services.calendar.model.EventDateTime;
+
 import java.util.Calendar;
 
 
     if (calendar == null) return -1;
     return calendar.getTimeInMillis() / 1000;
   }
+
+  public EventDateTime getEventDateTime() {
+    return new EventDateTime()
+        .setDateTime(new DateTime(calendar.getTime(), calendar.getTimeZone()));
+  }
 }