com.todoroo.astrid.data
Class Task

java.lang.Object
  extended by com.todoroo.andlib.data.AbstractModel
      extended by com.todoroo.astrid.data.RemoteModel
          extended by com.todoroo.astrid.data.Task
All Implemented Interfaces:
android.os.Parcelable, java.lang.Cloneable

public final class Task
extends RemoteModel

Data Model which represents a task users need to accomplish.

Author:
Tim Su

Nested Class Summary
 
Nested classes/interfaces inherited from class com.todoroo.andlib.data.AbstractModel
AbstractModel.ContentValuesSavingVisitor
 
Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.Creator<T>
 
Field Summary
static Property.StringProperty CALENDAR_URI
           
static Property.IntegerProperty COMMENT_COUNT
          Comment Count
static Property.LongProperty COMPLETION_DATE
          Unixtime Task was completed.
static android.net.Uri CONTENT_URI
          content uri for this model
static Property.LongProperty CREATION_DATE
          Unixtime Task was created
static android.os.Parcelable.Creator<Task> CREATOR
           
static Property.LongProperty CREATOR_ID
          Creator user id
static Property.LongProperty DELETION_DATE
          Unixtime Task was deleted.
static Property.StringProperty DETAILS
          Cached Details Column - built from add-on detail exposers.
static Property.LongProperty DETAILS_DATE
          Date details were last updated
static Property.LongProperty DUE_DATE
          Unixtime Task is due, 0 if not set
static Property.IntegerProperty ELAPSED_SECONDS
           
static Property.IntegerProperty ESTIMATED_SECONDS
           
static int FLAG_IS_READONLY
          whether task is read-only
static int FLAG_REPEAT_AFTER_COMPLETION
          whether repeat occurs relative to completion date instead of due date
static Property.IntegerProperty FLAGS
           
static Property.LongProperty HIDE_UNTIL
          Unixtime Task should be hidden until, 0 if not set
static int HIDE_UNTIL_DAY_BEFORE
           
static int HIDE_UNTIL_DUE
           
static int HIDE_UNTIL_NONE
          hide until array index -> significance
static int HIDE_UNTIL_SPECIFIC_DAY
           
static int HIDE_UNTIL_SPECIFIC_DAY_TIME
           
static int HIDE_UNTIL_WEEK_BEFORE
           
static Property.LongProperty ID
          ID
static Property.IntegerProperty IMPORTANCE
          Importance of Task (see importance flags)
static int IMPORTANCE_DO_OR_DIE
           
static int IMPORTANCE_LEAST
           
static int IMPORTANCE_MOST
           
static int IMPORTANCE_MUST_DO
           
static int IMPORTANCE_NONE
           
static int IMPORTANCE_SHOULD_DO
           
static Property.LongProperty LAST_SYNC
          Last Sync date
static Property.LongProperty MODIFICATION_DATE
          Unixtime Task was last touched
static Property.StringProperty NOTES
           
static int NOTIFY_AFTER_DEADLINE
          whether to send reminders while task is overdue
static int NOTIFY_AT_DEADLINE
          whether to send a reminder at deadline
static int NOTIFY_MODE_FIVE
          reminder mode five times (exclusive with non-stop)
static int NOTIFY_MODE_NONSTOP
          reminder mode non-stop
static Property.IntegerProperty POSTPONE_COUNT
           
static Property<?>[] PROPERTIES
          List of all properties for this model
static Property.StringProperty RECURRENCE
           
static Property.IntegerProperty REMINDER_FLAGS
          Flags for when to send reminders
static Property.LongProperty REMINDER_LAST
          Unixtime the last reminder was triggered
static Property.LongProperty REMINDER_PERIOD
          Reminder period, in milliseconds.
static Property.LongProperty REMINDER_SNOOZE
          Unixtime snooze is set (0 -> no snooze)
static Property.LongProperty REMOTE_ID
          Remote id
static Property.StringProperty SHARED_WITH
           
static Table TABLE
          table for this model
static Property.LongProperty TIMER_START
           
static Property.StringProperty TITLE
          Name of Task
static int URGENCY_DAY_AFTER
           
static int URGENCY_IN_TWO_WEEKS
           
static int URGENCY_NEXT_MONTH
           
static int URGENCY_NEXT_WEEK
           
static int URGENCY_NONE
          urgency array index -> significance
static int URGENCY_SPECIFIC_DAY
           
static int URGENCY_SPECIFIC_DAY_TIME
           
static int URGENCY_TODAY
           
static int URGENCY_TOMORROW
           
static Property.StringProperty USER
          User Object (JSON)
static Property.LongProperty USER_ID
          Assigned user id
static long USER_ID_EMAIL
          user id = read user email value
static long USER_ID_SELF
          user id = myself
static long USER_ID_UNASSIGNED
          user id = unassigned
 
Fields inherited from class com.todoroo.astrid.data.RemoteModel
REMOTE_ID_PROPERTY, REMOTE_ID_PROPERTY_NAME, USER_ID_PROPERTY, USER_JSON_PROPERTY
 
Fields inherited from class com.todoroo.andlib.data.AbstractModel
ID_PROPERTY, NO_ID
 
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
 
Constructor Summary
Task()
           
Task(TodorooCursor<Task> cursor)
           
 
Method Summary
static long createDueDate(int setting, long customDate)
          Creates due date for this task.
 long createHideUntil(int setting, long customDate)
          Create hide until for this task.
 android.content.ContentValues getDefaultValues()
          Get the default values for this object
 long getId()
          Utility method to get the identifier of the model, if it exists.
static int[] getImportanceColors(android.content.res.Resources r)
           
 boolean hasDueDate()
          Checks whether task is done.
 boolean hasDueTime()
          Checks whether this due date has a due time or only a date
static boolean hasDueTime(long dueDate)
          Checks whether provided due date has a due time or only a date
 boolean isCompleted()
          Checks whether task is done.
 boolean isDeleted()
          Checks whether task is deleted.
 boolean isHidden()
          Checks whether task is hidden.
 void readFromCursor(TodorooCursor<Task> cursor)
           
 
Methods inherited from class com.todoroo.andlib.data.AbstractModel
clear, clearValue, clone, containsNonNullValue, containsValue, describeContents, equals, getDatabaseValues, getFlag, getMergedValues, getSetValues, getTransitory, getValue, hashCode, isModified, isSaved, markSaved, mergeWith, putTransitory, setFlag, setId, setValue, writeToParcel
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE

public static final Table TABLE
table for this model


CONTENT_URI

public static final android.net.Uri CONTENT_URI
content uri for this model


ID

public static final Property.LongProperty ID
ID


TITLE

public static final Property.StringProperty TITLE
Name of Task


IMPORTANCE

public static final Property.IntegerProperty IMPORTANCE
Importance of Task (see importance flags)


DUE_DATE

public static final Property.LongProperty DUE_DATE
Unixtime Task is due, 0 if not set


HIDE_UNTIL

public static final Property.LongProperty HIDE_UNTIL
Unixtime Task should be hidden until, 0 if not set


CREATION_DATE

public static final Property.LongProperty CREATION_DATE
Unixtime Task was created


MODIFICATION_DATE

public static final Property.LongProperty MODIFICATION_DATE
Unixtime Task was last touched


COMPLETION_DATE

public static final Property.LongProperty COMPLETION_DATE
Unixtime Task was completed. 0 means active


DELETION_DATE

public static final Property.LongProperty DELETION_DATE
Unixtime Task was deleted. 0 means not deleted


DETAILS

public static final Property.StringProperty DETAILS
Cached Details Column - built from add-on detail exposers. A null value means there is no value in the cache and it needs to be refreshed


DETAILS_DATE

public static final Property.LongProperty DETAILS_DATE
Date details were last updated


FLAGS

public static final Property.IntegerProperty FLAGS

NOTES

public static final Property.StringProperty NOTES

ESTIMATED_SECONDS

public static final Property.IntegerProperty ESTIMATED_SECONDS

ELAPSED_SECONDS

public static final Property.IntegerProperty ELAPSED_SECONDS

TIMER_START

public static final Property.LongProperty TIMER_START

POSTPONE_COUNT

public static final Property.IntegerProperty POSTPONE_COUNT

REMINDER_FLAGS

public static final Property.IntegerProperty REMINDER_FLAGS
Flags for when to send reminders


REMINDER_PERIOD

public static final Property.LongProperty REMINDER_PERIOD
Reminder period, in milliseconds. 0 means disabled


REMINDER_LAST

public static final Property.LongProperty REMINDER_LAST
Unixtime the last reminder was triggered


REMINDER_SNOOZE

public static final Property.LongProperty REMINDER_SNOOZE
Unixtime snooze is set (0 -> no snooze)


RECURRENCE

public static final Property.StringProperty RECURRENCE

CALENDAR_URI

public static final Property.StringProperty CALENDAR_URI

REMOTE_ID

public static final Property.LongProperty REMOTE_ID
Remote id


USER_ID

public static final Property.LongProperty USER_ID
Assigned user id


USER

public static final Property.StringProperty USER
User Object (JSON)


CREATOR_ID

public static final Property.LongProperty CREATOR_ID
Creator user id


SHARED_WITH

public static final Property.StringProperty SHARED_WITH

COMMENT_COUNT

public static final Property.IntegerProperty COMMENT_COUNT
Comment Count


LAST_SYNC

public static final Property.LongProperty LAST_SYNC
Last Sync date


PROPERTIES

public static final Property<?>[] PROPERTIES
List of all properties for this model


FLAG_REPEAT_AFTER_COMPLETION

public static final int FLAG_REPEAT_AFTER_COMPLETION
whether repeat occurs relative to completion date instead of due date

See Also:
Constant Field Values

FLAG_IS_READONLY

public static final int FLAG_IS_READONLY
whether task is read-only

See Also:
Constant Field Values

USER_ID_EMAIL

public static final long USER_ID_EMAIL
user id = read user email value

See Also:
Constant Field Values

USER_ID_UNASSIGNED

public static final long USER_ID_UNASSIGNED
user id = unassigned

See Also:
Constant Field Values

USER_ID_SELF

public static final long USER_ID_SELF
user id = myself

See Also:
Constant Field Values

NOTIFY_AT_DEADLINE

public static final int NOTIFY_AT_DEADLINE
whether to send a reminder at deadline

See Also:
Constant Field Values

NOTIFY_AFTER_DEADLINE

public static final int NOTIFY_AFTER_DEADLINE
whether to send reminders while task is overdue

See Also:
Constant Field Values

NOTIFY_MODE_NONSTOP

public static final int NOTIFY_MODE_NONSTOP
reminder mode non-stop

See Also:
Constant Field Values

NOTIFY_MODE_FIVE

public static final int NOTIFY_MODE_FIVE
reminder mode five times (exclusive with non-stop)

See Also:
Constant Field Values

IMPORTANCE_DO_OR_DIE

public static final int IMPORTANCE_DO_OR_DIE
See Also:
Constant Field Values

IMPORTANCE_MUST_DO

public static final int IMPORTANCE_MUST_DO
See Also:
Constant Field Values

IMPORTANCE_SHOULD_DO

public static final int IMPORTANCE_SHOULD_DO
See Also:
Constant Field Values

IMPORTANCE_NONE

public static final int IMPORTANCE_NONE
See Also:
Constant Field Values

IMPORTANCE_MOST

public static int IMPORTANCE_MOST

IMPORTANCE_LEAST

public static int IMPORTANCE_LEAST

CREATOR

public static final android.os.Parcelable.Creator<Task> CREATOR

URGENCY_NONE

public static final int URGENCY_NONE
urgency array index -> significance

See Also:
Constant Field Values

URGENCY_TODAY

public static final int URGENCY_TODAY
See Also:
Constant Field Values

URGENCY_TOMORROW

public static final int URGENCY_TOMORROW
See Also:
Constant Field Values

URGENCY_DAY_AFTER

public static final int URGENCY_DAY_AFTER
See Also:
Constant Field Values

URGENCY_NEXT_WEEK

public static final int URGENCY_NEXT_WEEK
See Also:
Constant Field Values

URGENCY_IN_TWO_WEEKS

public static final int URGENCY_IN_TWO_WEEKS
See Also:
Constant Field Values

URGENCY_NEXT_MONTH

public static final int URGENCY_NEXT_MONTH
See Also:
Constant Field Values

URGENCY_SPECIFIC_DAY

public static final int URGENCY_SPECIFIC_DAY
See Also:
Constant Field Values

URGENCY_SPECIFIC_DAY_TIME

public static final int URGENCY_SPECIFIC_DAY_TIME
See Also:
Constant Field Values

HIDE_UNTIL_NONE

public static final int HIDE_UNTIL_NONE
hide until array index -> significance

See Also:
Constant Field Values

HIDE_UNTIL_DUE

public static final int HIDE_UNTIL_DUE
See Also:
Constant Field Values

HIDE_UNTIL_DAY_BEFORE

public static final int HIDE_UNTIL_DAY_BEFORE
See Also:
Constant Field Values

HIDE_UNTIL_WEEK_BEFORE

public static final int HIDE_UNTIL_WEEK_BEFORE
See Also:
Constant Field Values

HIDE_UNTIL_SPECIFIC_DAY

public static final int HIDE_UNTIL_SPECIFIC_DAY
See Also:
Constant Field Values

HIDE_UNTIL_SPECIFIC_DAY_TIME

public static final int HIDE_UNTIL_SPECIFIC_DAY_TIME
See Also:
Constant Field Values
Constructor Detail

Task

public Task()

Task

public Task(TodorooCursor<Task> cursor)
Method Detail

getImportanceColors

public static int[] getImportanceColors(android.content.res.Resources r)
Returns:
colors that correspond to importance values

getDefaultValues

public android.content.ContentValues getDefaultValues()
Description copied from class: AbstractModel
Get the default values for this object

Specified by:
getDefaultValues in class AbstractModel

readFromCursor

public void readFromCursor(TodorooCursor<Task> cursor)

getId

public long getId()
Description copied from class: AbstractModel
Utility method to get the identifier of the model, if it exists.

Specified by:
getId in class AbstractModel
Returns:
0L if this model was not added to the database

isCompleted

public boolean isCompleted()
Checks whether task is done. Requires COMPLETION_DATE


isDeleted

public boolean isDeleted()
Checks whether task is deleted. Will return false if DELETION_DATE not read


isHidden

public boolean isHidden()
Checks whether task is hidden. Requires HIDDEN_UNTIL


hasDueDate

public boolean hasDueDate()
Checks whether task is done. Requires DUE_DATE


createDueDate

public static long createDueDate(int setting,
                                 long customDate)
Creates due date for this task. If this due date has no time associated, we move it to the last millisecond of the day.

Parameters:
setting - one of the URGENCY_* constants
customDate - if specific day or day & time is set, this value

createHideUntil

public long createHideUntil(int setting,
                            long customDate)
Create hide until for this task.

Parameters:
setting - one of the HIDE_UNTIL_* constants
customDate - if specific day is set, this value
Returns:

hasDueTime

public boolean hasDueTime()
Checks whether this due date has a due time or only a date


hasDueTime

public static boolean hasDueTime(long dueDate)
Checks whether provided due date has a due time or only a date