Changeset 242
- Timestamp:
- 07/09/06 00:47:17 (18 years ago)
- Location:
- trunk/hiptop/pester
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hiptop/pester/locale/en_US/Pester.rsrc
r241 r242 98 98 99 99 typeAheadTextField 100 fillToRight = 0101 100 id = ID_MESSAGE_FIELD 102 alignBaseline = ID_MESSAGE_LABEL103 positionToRight = ID_MESSAGE_LABEL : 3104 101 autoCap 105 102 initiallySelectAll 106 103 initialFocus 104 alignBaseline = ID_MESSAGE_LABEL 105 positionToRight = ID_MESSAGE_LABEL : 3 106 fillToRight = 0 107 107 108 108 groupBox … … 175 175 button 176 176 id = ID_DISCARD_ALARM_BUTTON 177 event = EVENT_DISCARD_ALARM 177 178 position = buttonTop2 178 179 title = "Discard" 179 event = EVENT_DISCARD_ALARM180 180 181 181 button 182 182 id = ID_SET_ALARM_BUTTON 183 event = EVENT_SET_ALARM 183 184 position = buttonBottom1 184 185 title = "Set" 185 186 shortcut = doneButton 186 event = EVENT_SET_ALARM187 187 endDialog 188 189 alert ID_ALARM_ALERT 190 systemDialog 191 title = "Alarm" 192 icon = ID_LARGE_ICON 193 font = "BortBold12" 194 text = "Alarm!" 195 button 196 event = EVENT_DISMISS_ALARM 197 title = "OK" 198 position = buttonBottom1 199 shortcut = doneButton 200 endAlert -
trunk/hiptop/pester/net/sabi/pester/Alarm.java
r241 r242 5 5 import java.io.DataInputStream; 6 6 import java.io.DataOutputStream; 7 import danger.app.Application; 7 8 import danger.internal.Date; 9 import danger.util.StdActiveList; 8 10 import danger.util.StdActiveObject; 9 11 import danger.util.DEBUG; … … 20 22 // transient 21 23 private int mState; 24 private danger.app.Alarm mAlarm; 22 25 23 26 public Alarm() { 24 27 mState = STATE_INVALID; 28 mAlarm = new danger.app.Alarm(0, Application.getCurrentApp(), this); 25 29 } 26 30 … … 92 96 void beginEditing() { 93 97 mState = STATE_EDITING; 98 mAlarm.deactivate(); 94 99 } 95 100 96 void endEditing() { 101 void dismiss() { 102 if (getRepeating()) 103 schedule(); 104 else 105 ((StdActiveList)getDelegate()).removeItem(this); 106 } 107 108 void cancel() { 109 mState = STATE_INVALID; 110 mAlarm.deactivate(); 111 } 112 113 void schedule() { 97 114 mState = STATE_SCHEDULED; 98 115 DEBUG.p("schedule alarm: " + mMessage); … … 105 122 DEBUG.p(" - date: " + mDate); break; 106 123 } 124 mAlarm.resetWake(mPeriod); 107 125 } 108 126 … … 118 136 public static final int STATE_EDITING = 1; 119 137 public static final int STATE_SCHEDULED = 2; 120 public static final int STATE_EXPIRED = 3;121 138 } -
trunk/hiptop/pester/net/sabi/pester/AlarmListView.java
r241 r242 35 35 private Menu sPeriodUnitsMenu; 36 36 private PopupMenu sPeriodUnitsPopup; 37 // XXX don't allow <5 second repeating alarms 37 38 private CheckBox sRepeatCheckBox; 38 39 private DateTimeEditor sTimeEditor, sDateEditor; … … 128 129 protected void constrainDate() { 129 130 // XXX schedule every minute (second?) if in AT mode 131 // XXX could use onPeriodicPulse() perhaps 130 132 Date now = new Date(); 131 133 sDateEditor.min(now); 132 134 sDatePicker.min(now); 133 sSetAlarmButton.setEnabled(editingDate().compareTo(now) > 0); 135 sSetAlarmButton.setEnabled(sInButton.getValue() == 1 || 136 editingDate().compareTo(now) > 0); 134 137 } 135 138 … … 153 156 sAlarmList.addItem(sEditingAlarm); 154 157 setFocusedItem(sEditingAlarm); 155 sFocusedAlarm = sEditingAlarm; // XXX do we need this?158 sFocusedAlarm = sEditingAlarm; 156 159 } else { 157 160 sEditingAlarm.update(); 158 161 } 159 162 case EVENT_CANCEL_ALARM: 160 if (sEditingAlarm == sFocusedAlarm) { // existing alarm 161 // XXX (re)schedule alarm 162 sEditingAlarm.endEditing(); 163 } 163 if (sEditingAlarm == sFocusedAlarm) 164 sEditingAlarm.schedule(); 164 165 sEditingAlarm = null; 165 166 return true; … … 170 171 case EVENT_IN: 171 172 sAtButton.setValue(0); 173 constrainDate(); 172 174 return true; 173 175 case EVENT_AT: … … 177 179 case EVENT_TIME_EDITOR: 178 180 Date date = editingDate(); 179 // XXX factor this out (it's used twice)180 181 // XXX do this on exit from the field, not on change 181 182 if (date.compareTo(new Date()) <= 0) { … … 214 215 } 215 216 public void onItemRemoved(ActiveList list, Object item, int index) { 217 ((Alarm)item).cancel(); 216 218 sAlarmListWindow.updateAlarmCount(); 217 219 super.onItemRemoved(list, item, index); -
trunk/hiptop/pester/net/sabi/pester/AlarmListWindow.java
r237 r242 19 19 StringBuffer sb = new StringBuffer().append(size).append(" alarm"); 20 20 if (size != 1) sb.append('s'); 21 sb.append(" set");21 // sb.append(" set"); 22 22 setSubTitle(sb.toString()); 23 23 } -
trunk/hiptop/pester/net/sabi/pester/Pester.java
r237 r242 2 2 3 3 import danger.app.Application; 4 import danger.app.Event; 5 import danger.ui.AlertWindow; 4 6 import danger.ui.ScreenWindow; 7 import danger.util.DEBUG; 8 import java.util.Stack; 5 9 6 10 public class Pester extends Application implements Resources, Commands { 11 private static ScreenWindow sAlarmListWindow; 12 private static Stack sAlarmStack; 13 7 14 public Pester() { 8 alarmListWindow = (ScreenWindow)getResources().getScreen(ID_ALARM_LIST_SCREEN); 9 alarmListWindow.show(); 15 sAlarmListWindow = (ScreenWindow)getResources().getScreen(ID_ALARM_LIST_SCREEN); 16 sAlarmListWindow.show(); 17 sAlarmStack = new Stack(); 10 18 } 11 19 12 static private ScreenWindow alarmListWindow; 20 public boolean receiveEvent(Event e) { 21 switch (e.type) { 22 case Event.EVENT_ALARM: 23 Alarm alarm = (Alarm)e.argument; 24 AlertWindow alert = getAlert(ID_ALARM_ALERT, this); 25 alert.setMessage(alarm.getMessage()); 26 // alert.setMessageFormatDate(alarm.getDate()); 27 alert.show(AlertWindow.SYSTEM_ALERT_TYPE_ALARM); 28 sAlarmStack.push(alarm); 29 return true; 30 case EVENT_DISMISS_ALARM: 31 ((Alarm)sAlarmStack.pop()).dismiss(); 32 return true; 33 } 34 return super.receiveEvent(e); 35 } 13 36 }
Note:
See TracChangeset
for help on using the changeset viewer.