Changeset 287 for trunk/hiptop/pester


Ignore:
Timestamp:
07/25/06 16:36:34 (18 years ago)
Author:
Nicholas Riley
Message:

First pass at alarm snooze/reschedule; still pretty ugly.

Location:
trunk/hiptop/pester
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/hiptop/pester/locale/en_US/Pester.rsrc

    r283 r287  
    209209endDialog
    210210
    211 alert ID_ALARM_ALERT
     211textInputAlert ID_ALARM_ALERT
    212212        systemDialog
    213213        title = "Alarm"
     
    216216        text = "Alarm!"
    217217        button
     218                id = ID_SNOOZE_BUTTON
    218219                event = EVENT_SNOOZE_ALARM
    219220                title = "Snooze"
    220                 position = buttonTop1
     221                position = buttonBottom2
    221222                shortcut = cancelButton
    222223        button
    223224                event = EVENT_SET_ALARM
    224225                title = "Reschedule..."
    225                 position = buttonBottom2
     226                position = buttonBottom3
    226227        button
    227228                event = EVENT_DISMISS_ALARM
     
    229230                position = buttonBottom1
    230231                shortcut = doneButton
    231 endAlert
     232        textField
     233                id = ID_SNOOZE_MINUTES
     234                title = "Snooze for minutes:"
     235                dontAcceptKeyRepeats
     236                initiallySelectAll
     237                numericOnly
     238                justifyRight
     239                maxLength = 2
     240                position = top
     241endTextInputAlert
    232242
    233243alert ID_DISCARD_ALERT
  • trunk/hiptop/pester/net/sabi/pester/Alarm.java

    r280 r287  
    7979    public void setUID(int uid) {
    8080        mUID = uid;
     81    }
     82    public void snoozeForMinutes(int minutes) {
     83        mDate = new Date();
     84        mDate.addMinutes(minutes);
     85        resume();
    8186    }
    8287
  • trunk/hiptop/pester/net/sabi/pester/Pester.java

    r278 r287  
    33import danger.app.Application;
    44import danger.app.Event;
    5 import danger.ui.AlertWindow;
     5import danger.app.IPCMessage;
     6import danger.ui.Layout;
     7import danger.ui.TextField;
     8import danger.ui.TextInputAlertWindow;
    69import danger.ui.ScreenWindow;
     10import danger.ui.StaticText;
    711import danger.util.DEBUG;
    812import java.util.Stack;
     
    2226        case Event.EVENT_ALARM:
    2327            Alarm alarm = (Alarm)e.argument;
    24             AlertWindow alert = getAlert(ID_ALARM_ALERT, this);
     28            TextInputAlertWindow alert = getTextInputAlert(ID_ALARM_ALERT, this);
    2529            alert.setTitle(alarm.getDateTimeString());
    2630            alert.setMessage(alarm.getMessage());
    2731            alert.setShowTone(alarm.getAlert());
    28             alert.show(AlertWindow.SYSTEM_ALERT_TYPE_ALARM);
     32            alert.disableButtonOnEmptyField(ID_SNOOZE_BUTTON, ID_SNOOZE_MINUTES);
     33            alert.setShowCancel(false);
     34            alert.show(TextInputAlertWindow.SYSTEM_ALERT_TYPE_ALARM);
    2935            sAlarmStack.push(alarm);
     36            return true;
     37        case EVENT_SET_ALARM:
     38            AlarmSetDialog alarmSetDialog = AlarmSetDialog.getDialog();
     39            alarmSetDialog.setWindowStyle(AlarmSetDialog.SYSTEM_DIALOG_STYLE);
     40            alarmSetDialog.editAlarm((Alarm)sAlarmStack.pop(),false);
     41            return true;
     42        case EVENT_SNOOZE_ALARM:
     43            String snoozeMinutesString =
     44                TextInputAlertWindow.
     45                getTextFieldValue((IPCMessage)e.argument,
     46                                  ID_SNOOZE_MINUTES);
     47            int snoozeMinutes = Integer.parseInt(snoozeMinutesString);
     48            ((Alarm)sAlarmStack.pop()).snoozeForMinutes(snoozeMinutes);
    3049            return true;
    3150        case EVENT_DISMISS_ALARM:
Note: See TracChangeset for help on using the changeset viewer.