Changeset 273
- Timestamp:
- 07/22/06 04:01:48 (18 years ago)
- Location:
- trunk/hiptop/pester/net/sabi/pester
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hiptop/pester/net/sabi/pester/Alarm.java
r259 r273 249 249 } 250 250 251 public int getSecondsUntilNextIntervalStringUpdate() { 252 int i = remainingInterval(); 253 if (i == 1) 254 return 0; 255 if (i <= 60) 256 return 1; 257 if (i <= 24 * 60 * 60) 258 return i % 60; 259 return i % 3600; // update at least once an hour, regardless 260 } 261 251 262 public String getDateTimeString(boolean relative) { 252 263 return dateTimeString(mDate, relative); -
trunk/hiptop/pester/net/sabi/pester/AlarmListView.java
r260 r273 5 5 import danger.ui.AlertWindow; 6 6 import danger.ui.ActiveListView; 7 import danger.ui.Rect; 8 import danger.ui.ToolTipWindow; 7 9 import danger.util.ActiveList; 8 10 import danger.util.DEBUG; … … 15 17 private static AlarmSetDialog sAlarmSetDialog; 16 18 19 private danger.app.Alarm mToolTipAlarm; 20 private ToolTipWindow mToolTipWindow; 21 17 22 public void onDecoded() { 18 23 sAlarmListWindow = (AlarmListWindow)getWindow(); 19 24 setList(Alarms.getList()); 25 mToolTipAlarm = new danger.app.Alarm(0, this); 20 26 super.onDecoded(); 21 27 } … … 54 60 Alarms.removeAlarm((Alarm)getFocusedItem()); 55 61 return true; 62 case Event.EVENT_ALARM: // tooltip invalid 63 // XXX should do this too if the time changes 64 showToolTip(); 65 return true; 56 66 } 57 67 return super.receiveEvent(e); … … 62 72 return; 63 73 alarmSetDialog().editAlarm((Alarm)item, false); 74 } 75 76 protected void itemFocused(Object item) { 77 mToolTipAlarm.deactivate(); 78 } 79 80 public void loseFocus() { 81 mToolTipAlarm.deactivate(); 82 super.loseFocus(); 83 } 84 85 public void showToolTip() { 86 Alarm alarm = (Alarm)getFocusedItem(); 87 if (alarm == null) 88 return; 89 Rect rect = new Rect(); 90 rect = localToGlobal(getInterestingRect(rect)); 91 if (mToolTipWindow != null) 92 mToolTipWindow.hide(); 93 mToolTipWindow = 94 ToolTipWindow.showToolTip(alarm.getDateTimeString() + " - " + 95 alarm.getIntervalString(), 96 10, rect.bottom, 1, sAlarmListWindow); 97 int secondsUntilUpdate = alarm.getSecondsUntilNextIntervalStringUpdate(); 98 if (secondsUntilUpdate == 0) 99 return; 100 mToolTipAlarm.resetWake(secondsUntilUpdate); 64 101 } 65 102 … … 79 116 super.onItemRemoved(list, item, index); 80 117 } 81 82 protected CharSequence getToolTipForItem(Object item) {83 if (item == null) // this is dumb, why do we get asked for a tooltip?84 return null;85 // XXX need to refresh, localize86 Alarm alarm = (Alarm)item;87 return alarm.getDateTimeString() + " - " + alarm.getIntervalString();88 }89 118 }
Note:
See TracChangeset
for help on using the changeset viewer.