Android Open Source - android-calendar-drafts Insert Repeatable Event Cmd






From Project

Back to project page android-calendar-drafts.

License

The source code is released under:

Apache License

If you think the Android project android-calendar-drafts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.touchableheroes.drafts.calendar.cmd;
/*from www .  ja va  2 s. co  m*/
import java.util.TimeZone;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.net.Uri;
import android.os.Build;
import android.provider.CalendarContract.Events;

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class InsertRepeatableEventCmd extends ContextCmd {

  public InsertRepeatableEventCmd(final Activity ctx) {
    super(ctx);
  }

  /**
   * @param calenderId
   * @param start
   * @param end
   * @param title
   * @param description
   * @param rrule
   * @param duration
   * 
   * @return
   */
  @SuppressLint("InlinedApi")
  public Uri exec(final int calenderId, final long start, final long end,
      final String title, final String description, final String rrule,
      final String duration) {
    final ContentResolver cr = getContentResolver();

    final ContentValues values = new ContentValues();

    values.put(Events.CALENDAR_ID, calenderId);

    values.put(Events.DTSTART, start);
    values.put(Events.DTEND, end);

    if (!(rrule == null || rrule.length() < 1)) {
      values.put(Events.RRULE, rrule);
      values.put(Events.DURATION, duration);
    }

    values.put(Events.ALL_DAY, 0);

    values.put(Events.TITLE, title);
    values.put(Events.DESCRIPTION, description);

    final TimeZone zone = TimeZone.getDefault();
    values.put(Events.EVENT_TIMEZONE, zone.getID());

    return cr.insert(Events.CONTENT_URI, values);
  }
}

// intent.putExtra("allDay", true);
// intent.putExtra("rrule", "FREQ=YEARLY");
//
// values.put(Events.RRULE,
// 17
// "FREQ=DAILY;COUNT=20;BYDAY=MO,TU,WE,TH,FR;WKST=MO");
//
// }





Java Source Code List

com.touchableheroes.drafts.calendar.Start.java
com.touchableheroes.drafts.calendar.cmd.ContextCmd.java
com.touchableheroes.drafts.calendar.cmd.DeleteEventByHeaderCmd.java
com.touchableheroes.drafts.calendar.cmd.DeleteEventCmd.java
com.touchableheroes.drafts.calendar.cmd.ExistsEventCmd.java
com.touchableheroes.drafts.calendar.cmd.InsertDaylyRepeatableEventCmd.java
com.touchableheroes.drafts.calendar.cmd.InsertEventCmd.java
com.touchableheroes.drafts.calendar.cmd.InsertReminderCmd.java
com.touchableheroes.drafts.calendar.cmd.InsertRepeatableEventCmd.java
com.touchableheroes.drafts.calendar.cmd.LoadEventByIdCmd.java
com.touchableheroes.drafts.calendar.cmd.LoadEventsCmd.java
com.touchableheroes.drafts.calendar.cmd.ModifyEventCmd.java
com.touchableheroes.drafts.calendar.cmd.UpdateEventByHeaderCmd.java
com.touchableheroes.drafts.calendar.cursor.GetValueFacade.java
com.touchableheroes.drafts.calendar.dao.EventId.java
com.touchableheroes.drafts.calendar.dao.Event.java
com.touchableheroes.drafts.calendar.dao.EventsDAO.java
com.touchableheroes.drafts.calendar.util.WherePart.java
com.touchableheroes.drafts.calendar.util.WhereQueryPartBuilder.java