OSDN Git Service

b/1911244 Increment the day if the end time is earlier than the start time.
authorMichael Chan <mchan@android.com>
Tue, 16 Feb 2010 22:14:47 +0000 (14:14 -0800)
committerMichael Chan <mchan@android.com>
Tue, 16 Feb 2010 22:14:47 +0000 (14:14 -0800)
Change-Id: Ic3ecafebec0ba964b9f94671e149c88738b62448

src/com/android/calendar/EditEvent.java

index c1fabd6..6649154 100644 (file)
@@ -289,21 +289,20 @@ public class EditEvent extends Activity implements View.OnClickListener,
                 // Also update the end time to keep the duration constant.
                 endTime.hour = hourOfDay + hourDuration;
                 endTime.minute = minute + minuteDuration;
-                endMillis = endTime.normalize(true);
             } else {
                 // The end time was changed.
                 startMillis = startTime.toMillis(true);
                 endTime.hour = hourOfDay;
                 endTime.minute = minute;
-                endMillis = endTime.normalize(true);
 
-                // Do not allow an event to have an end time before the start time.
+                // Move to the next day if the end time is before the start time.
                 if (endTime.before(startTime)) {
-                    endTime.set(startTime);
-                    endMillis = startMillis;
+                    endTime.monthDay = startTime.monthDay + 1;
                 }
             }
 
+            endMillis = endTime.normalize(true);
+
             setDate(mEndDateButton, endMillis);
             setTime(mStartTimeButton, startMillis);
             setTime(mEndTimeButton, endMillis);