Last change
on this file since 283 was 278, checked in by Nicholas Riley, 18 years ago |
Display message on empty list (no longer need to add/remove border). Don't let alarms go off while you're deciding whether to discard them. First, untested attempt at handling hard resets (waiting on advice from Danger). Very ugly rewrite of alarm alert; needs much fixing.
|
File size:
1.0 KB
|
Line | |
---|
1 | package net.sabi.pester;
|
---|
2 |
|
---|
3 | import danger.app.Application;
|
---|
4 | import danger.app.Event;
|
---|
5 | import danger.ui.AlertWindow;
|
---|
6 | import danger.ui.ScreenWindow;
|
---|
7 | import danger.util.DEBUG;
|
---|
8 | import java.util.Stack;
|
---|
9 |
|
---|
10 | public class Pester extends Application implements Resources, Commands {
|
---|
11 | private static ScreenWindow sAlarmListWindow;
|
---|
12 | private static Stack sAlarmStack;
|
---|
13 |
|
---|
14 | public Pester() {
|
---|
15 | sAlarmListWindow = (ScreenWindow)getResources().getScreen(ID_ALARM_LIST_SCREEN);
|
---|
16 | sAlarmListWindow.show();
|
---|
17 | sAlarmStack = new Stack();
|
---|
18 | }
|
---|
19 |
|
---|
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.setTitle(alarm.getDateTimeString());
|
---|
26 | alert.setMessage(alarm.getMessage());
|
---|
27 | alert.setShowTone(alarm.getAlert());
|
---|
28 | alert.show(AlertWindow.SYSTEM_ALERT_TYPE_ALARM);
|
---|
29 | sAlarmStack.push(alarm);
|
---|
30 | return true;
|
---|
31 | case EVENT_DISMISS_ALARM:
|
---|
32 | ((Alarm)sAlarmStack.pop()).dismiss();
|
---|
33 | return true;
|
---|
34 | }
|
---|
35 | return super.receiveEvent(e);
|
---|
36 | }
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.