@@ -0,0 +1,2069 @@
+package com.mamewo.stacklr;%0A%0Aimport com.google.api.client.util.DateTime;%0Aimport com.google.api.services.calendar.model.EventDateTime;%0Aimport com.google.api.services.calendar.model.Event;%0Aimport com.google.api.services.calendar.Calendar;%0Aimport com.google.api.client.util.DateTime;%0A%0Aimport java.util.Date;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport static com.mamewo.stacklr.Constant.*;%0Aimport android.util.Log;%0A%0Apublic class AsyncAddGoogleCalendarEvent%0A%09extends CommonAsyncTask%0A%7B%0A%09static final%0A    private String CHECK_MARK = %22%5Cu2714%22;%0A%09private String calendarId_;%0A%09private List%3CString%3E items_;%0A%0A%09public AsyncAddGoogleCalendarEvent(StacklrExpActivity activity, String calendarId, List%3CString%3E items)%7B%0A%09%09super(activity);%0A%09%09calendarId_ = calendarId;%0A%09%09items_ = items;%0A%09%7D%0A%0A%09public AsyncAddGoogleCalendarEvent(StacklrExpActivity activity, String calendarId, String item)%7B%0A%09%09super(activity);%0A%09%09calendarId_ = calendarId;%0A%09%09items_ = new ArrayList%3CString%3E();%0A%09%09items_.add(item);%0A%09%7D%0A%0A%09@Override%0A%09protected void doInBackground()%0A%09%09throws IOException%0A%09%7B%0A%09%09//TODO: batch?%0A%09%09%0A%09%09//5 min%0A%09%09long EVENT_INTERVAL = 5*60*1000;%0A%09%09long nowmillis = java.util.Calendar.getInstance().getTimeInMillis();%0A%09%09EventDateTime nowtime = new EventDateTime().setDateTime(new DateTime(new Date(nowmillis)));%0A%09%09EventDateTime endtime = new EventDateTime().setDateTime(new DateTime(new Date(nowmillis+EVENT_INTERVAL)));%0A%09%09for(String item: items_)%7B%0A%09%09%09Event event = new Event()%0A%09%09%09%09.setSummary(CHECK_MARK+item)%0A%09%09%09%09.setStart(nowtime)%0A%09%09%09%09.setEnd(endtime);%0A%09%09%09calendarClient_.events().insert(calendarId_, event).execute();%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09protected void onPostExecute(Boolean success) %7B%0A%09%09super.onPostExecute(success);%0A%09%7D%0A%0A%09static%0A%09public void run(StacklrExpActivity activity, String calendarId, String item) %7B%0A%09%09new AsyncAddGoogleCalendarEvent(activity, calendarId, item).execute();%0A%09%7D%0A%0A%09static%0A%09public void run(StacklrExpActivity activity, String calendarId, List%3CString%3E items) %7B%0A%09%09new AsyncAddGoogleCalendarEvent(activity, calendarId, items).execute();%0A%09%7D%0A%7D%0A

add class to log done event