diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-05-18 11:10:44 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2010-05-18 11:10:44 -0700 |
commit | ec5daf689279afeccad68f211e37994d64d4fb53 (patch) | |
tree | be8e580872fe9318e63f76b9b91b56a0d9df9105 /src/com/android/calendar/Event.java | |
parent | f1db29f8bbeadcd890785d089163ce0a3e5d9a9e (diff) | |
parent | 4ce500bd7d08eac3f05dfd50bce51e620fa9f08e (diff) | |
download | android_packages_apps_Calendar-ec5daf689279afeccad68f211e37994d64d4fb53.tar.gz android_packages_apps_Calendar-ec5daf689279afeccad68f211e37994d64d4fb53.tar.bz2 android_packages_apps_Calendar-ec5daf689279afeccad68f211e37994d64d4fb53.zip |
merge from open-source master
Change-Id: Ic1aed0d5f6e1ad337b84e8619c3f6e2f22565ed1
Diffstat (limited to 'src/com/android/calendar/Event.java')
-rw-r--r-- | src/com/android/calendar/Event.java | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/com/android/calendar/Event.java b/src/com/android/calendar/Event.java index c3789a7e..32a6131b 100644 --- a/src/com/android/calendar/Event.java +++ b/src/com/android/calendar/Event.java @@ -35,7 +35,7 @@ import java.util.Iterator; import java.util.concurrent.atomic.AtomicInteger; // TODO: should Event be Parcelable so it can be passed via Intents? -public class Event implements Comparable, Cloneable { +public class Event implements Comparable<Event>, Cloneable { private static final boolean PROFILE = false; @@ -117,8 +117,6 @@ public class Event implements Comparable, Cloneable { public Event nextUp; public Event nextDown; - private static final int MIDNIGHT_IN_MINUTES = 24 * 60; - @Override public final Object clone() throws CloneNotSupportedException { super.clone(); @@ -187,32 +185,30 @@ public class Event implements Comparable, Cloneable { * Compares this event to the given event. This is just used for checking * if two events differ. It's not used for sorting anymore. */ - public final int compareTo(Object obj) { - Event e = (Event) obj; - + public final int compareTo(Event obj) { // The earlier start day and time comes first - if (startDay < e.startDay) return -1; - if (startDay > e.startDay) return 1; - if (startTime < e.startTime) return -1; - if (startTime > e.startTime) return 1; + if (startDay < obj.startDay) return -1; + if (startDay > obj.startDay) return 1; + if (startTime < obj.startTime) return -1; + if (startTime > obj.startTime) return 1; // The later end time comes first (in order to put long strips on // the left). - if (endDay < e.endDay) return 1; - if (endDay > e.endDay) return -1; - if (endTime < e.endTime) return 1; - if (endTime > e.endTime) return -1; + if (endDay < obj.endDay) return 1; + if (endDay > obj.endDay) return -1; + if (endTime < obj.endTime) return 1; + if (endTime > obj.endTime) return -1; // Sort all-day events before normal events. - if (allDay && !e.allDay) return -1; - if (!allDay && e.allDay) return 1; + if (allDay && !obj.allDay) return -1; + if (!allDay && obj.allDay) return 1; - if (guestsCanModify && !e.guestsCanModify) return -1; - if (!guestsCanModify && e.guestsCanModify) return 1; + if (guestsCanModify && !obj.guestsCanModify) return -1; + if (!guestsCanModify && obj.guestsCanModify) return 1; // If two events have the same time range, then sort them in // alphabetical order based on their titles. - int cmp = compareStrings(title, e.title); + int cmp = compareStrings(title, obj.title); if (cmp != 0) { return cmp; } @@ -220,12 +216,12 @@ public class Event implements Comparable, Cloneable { // If the titles are the same then compare the other fields // so that we can use this function to check for differences // between events. - cmp = compareStrings(location, e.location); + cmp = compareStrings(location, obj.location); if (cmp != 0) { return cmp; } - cmp = compareStrings(organizer, e.organizer); + cmp = compareStrings(organizer, obj.organizer); if (cmp != 0) { return cmp; } |