Ejemplo n.º 1
0
 /**
  * 保存本地事件
  *
  * @param event 事件
  * @param cid 日历ID
  * @param calendarAccount 日历帐号
  * @return
  * @throws Exception
  */
 public FDEvent saveGo2Events(FDEvent event, FDCalendar cal) throws Exception {
   Map<String, String> params = new HashMap<String, String>();
   params.put("method", "add");
   params.put("title", event.getTitle());
   params.put("description", event.getNote());
   params.put("start", FDTimeFormatUtil.sdfAllDate.format(event.getFromDateByTimeZone()));
   params.put("timezone", event.getTimezone());
   params.put("end", FDTimeFormatUtil.sdfAllDate.format(event.getToDateByTimeZone()));
   params.put("isAllDay", event.isAllDay() ? "1" : "0");
   params.put("location", event.getLocation());
   params.put("cid", event.getCalendarId());
   params.put("recurrence", event.getRecurrence());
   params.put("recurringEventId", event.getRecurringEventId());
   params.put("status", event.getStatus() + "");
   params.put("originalStartTime", event.getOriginalStartTime());
   FDEvent receiveEvent = null;
   FDJson json = sendPOSTRequestByJson("user/privateEvent", params);
   if (json != null) {
     if (json.getStatusCode() != 1) {
       return null;
     }
     receiveEvent = new FDEvent(json.getData(), cal, FDCalendarAccount.TYPE_GO2);
   }
   return receiveEvent;
 }
Ejemplo n.º 2
0
 // 获取外部传入的事件
 private void getIntentToEvent() {
   Bundle extras = getIntent().getExtras();
   Calendar c = Calendar.getInstance();
   if (extras != null) {
     isEdit = extras.getBoolean(BUNDLE_KEY_IS_EDIT, false);
     event = (FDEvent) extras.getParcelable(FDEvent.BUNDLE_KEY);
     if (event != null) {
       fromHour = event.getFromHour();
       fromMinute = event.getFromMinute();
       toHour = event.getToHour();
       toMinute = event.getToMinute();
       isAllDay = event.isAllDay();
       c.set(Calendar.YEAR, event.getYear());
       c.set(Calendar.MONTH, event.getMonth() - 1);
       c.set(Calendar.DAY_OF_MONTH, event.getDay());
       fromDay = new FDDay(c);
       c.set(Calendar.YEAR, event.getToYear());
       c.set(Calendar.MONTH, event.getToMonth() - 1);
       c.set(Calendar.DAY_OF_MONTH, event.getToDay());
       toDay = new FDDay(c);
       etTitle.setText(event.getTitle());
       etNote.setText(event.getNote());
       if (null != event.getRecurrence()) {
         repeat = new FDRepeat(event.getRecurrence());
       }
       if (isEdit) {
         originalDay = fromDay;
       }
       return;
     }
     fromDay = (FDDay) extras.getParcelable(FDDay.BUNDLE_KEY);
     if (fromDay != null) {
       toDay = fromDay.clone();
       fromHour = c.get(Calendar.HOUR_OF_DAY);
       toHour = fromHour + 1;
       fromMinute = 0;
       toMinute = 0;
       isAllDay = false;
     }
   }
 }