Changeset 269 for trunk/hiptop/pester
- Timestamp:
- 07/20/06 20:09:20 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hiptop/pester/net/sabi/pester/AlarmSetDialog.java
r258 r269 56 56 mMessageField = 57 57 (TypeAheadTextField)getDescendantWithID(ID_MESSAGE_FIELD); 58 disableBottomRightButtonOnEmptyField(mMessageField);59 58 mInButton = (RadioButton)getDescendantWithID(ID_IN_BUTTON); 60 59 mAtButton = (RadioButton)getDescendantWithID(ID_AT_BUTTON); … … 91 90 } 92 91 92 protected void editDate(Date date) { 93 // time and date editors must share the same date object 94 mTimeEditor.setDate(date); 95 mDateEditor.setDate(date); 96 mDatePicker.setDate(date); 97 } 98 93 99 protected void editAlarm(Alarm alarm) { 94 100 mMessageField.setText(alarm.getMessage()); … … 108 114 } 109 115 110 Date date = new Date(alarm.getDate()); 111 mTimeEditor.setDate(date); 112 mDateEditor.setDate(date); 113 mDatePicker.setDate(date); 116 editDate(new Date(alarm.getDate())); 114 117 115 118 mInButton.setValue(usesPeriod ? 1 : 0); … … 162 165 date.addSeconds(editingInterval()); 163 166 } else { 164 // XXX is it necessary to do this, or do the two share the165 // XXX same physical Date object?166 167 date = mDateEditor.getDate(); 167 date.setTime(mTimeEditor.getDate().getTime());168 DEBUG.p("+ time editor.getTime = " + Alarm.dateTimeString(date, false)); 168 169 date.setSeconds(0); 170 DEBUG.p("+ seconds 0 = " + Alarm.dateTimeString(date, false)); 169 171 } 170 172 return date; … … 179 181 } 180 182 Date now = new Date(); 181 mDateEditor.min(now);182 mDatePicker.min(now);183 183 Date editingDate = editingDate(); 184 184 if (isIn()) { … … 193 193 mValidateAlarm.resetWake(secondsUntilDate); 194 194 } 195 // we read the time from the date editor; if we constrain it to 196 // absolutely now, we won't read an earlier time even if the time 197 // editor sets it 198 now.setTime(0); 199 mDateEditor.min(now); 200 mDatePicker.min(now); 195 201 mStatusBox.setText(Alarm.dateTimeString(editingDate, true)); 196 202 return true; … … 257 263 return true; 258 264 case EVENT_DATE_EDITOR_TOOK_FOCUS: 265 { 259 266 Date date = editingDate(); 260 if (date.compareTo(new Date()) <= 0) { 261 date.addDays(1); 262 mDatePicker.setDate(date); 263 mDateEditor.setDate(date); 264 } 265 validate(); 266 return true; 267 Date now = new Date(); 268 if (date.compareTo(now) <= 0) { 269 date.setToday(); 270 if (date.compareTo(now) <= 0) 271 date.addDays(1); // tomorrow 272 editDate(date); 273 } 274 validate(); 275 return true; 276 } 267 277 case EVENT_DATE_EDITOR: 268 278 mDatePicker.setDate(mDateEditor.getDate()); … … 270 280 return true; 271 281 case EVENT_DATE_PICKER: 272 mDateEditor.setDate((Date)e.argument); 273 validate(); 274 return true; 282 { 283 Date date = (Date)e.argument; 284 date.setTime(mDateEditor.getDate().getTime()); 285 mTimeEditor.setDate(date); 286 mDateEditor.setDate(date); 287 validate(); 288 return true; 289 } 275 290 } 276 291 return super.receiveEvent(e);
Note:
See TracChangeset
for help on using the changeset viewer.