My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CalendarPickerAPI  
Interface specification for OI Calendar Picker
Updated Jul 9, 2011 by kostmo

Introduction

OI Calendar Picker is a utility to pick dates and events and visualize timeline-based information. It features:

  • smooth vertical flinging
  • horizontal and vertical orientation
  • horizontal swipe between months
  • date picking
  • event frequency visualization
  • event picking

User Installation

When launching the Calendar Picker Intent, one may check whether the matching Activity is found and prompt the user to install it if necessary (see demo code). One may either direct the user to the Android Market for the application package org.openintents.calendarpicker or offer a direct web download of the .apk from this list.

Interface Specification

Contants

All of the constants are available in the file CalendarPickerConstants.java. You may include this single file in your application to simplify code maintenance.

Database columns

Clients should implement a ContentProvider that supplies a list of events with mime-type of vnd.android.cursor.dir/event and columns as follows

Column Name Data type Description
_id long Event ID
dtstart long Unix time (milliseconds)
title String Human-readable title of event
calendar_id long For limiting events to a certain calendar

In addition to these mandatory columns, you may supply auxiliary "quantity" columns, with column names specified in the Intent extras.

Intent Extras

Input

Optional: A "calendar_id" to limit events from the ContentProvider to a particular calendar.

Optional: org.openintents.calendarpicker.intent.extra.VISUALIZE_QUANTITIES -- A boolean to indicate whether the calendar days should be color mapped to a scale determined by the range of "quantity", aggregated for each day.

Optionally, one may provide a starting date for the calendar to display. This should be an epoch value as documented below.

Arbitrary quantities can be associated with events...

Output

The epoch is a long value representing the number of milliseconds since midnight on January 1, 1970 (See Unix time).

The additional extra, datetime, is a hyphenated year-month-date String in ISO 8601 format.

Both datetime and epoch shall represent the same time.

Database Techniques

To aggregate data per day within SQLite, you can create a VIEW with a truncated timestamp column.

"CAST((CAST(" + MY_TIMESTAMP_COLUMN + "/" + MILLISECONDS_PER_DAY + " AS INTEGER)*" + MILLISECONDS_PER_DAY + ") AS INTEGER) " + CalendarPickerConstants.CalendarEventPicker.ContentProviderColumns.TIMESTAMP

This gives the same timestamp value to all events that fall on the same day. Then you can perform GROUP BY queries on the timestamp column to COUNT or SUM other quantities over all events in the day.

Screenshots

Comment by estee...@gmail.com, Apr 26, 2012

Is it feasible to incorporate this widget directly into app, without resorting to inter-process communication?


Sign in to add a comment
Powered by Google Project Hosting