Changeset 295 for trunk/hiptop


Ignore:
Timestamp:
07/28/06 08:33:38 (18 years ago)
Author:
Nicholas Riley
Message:

Move discard alert text to resource. Fix listener for
EVENT_TIME_CHANGED I broke a few days ago. Only use
Alarm.mAbsoluteFireTime to measure real time if the alarm was
scheduled/rescheduled (through user action, not restoration from a
datastore) since boot. Don't display dates in the past as if they're
in the following week.

Location:
trunk/hiptop/pester
Files:
4 edited

Legend:

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

    r294 r295  
    276276        title = "Discard Alarm?"
    277277        icon = stopIcon
    278         text = "Permanently discard this alarm?"
     278        text = "Permanently discard \u201c^0\u201d?"
    279279        button
    280280                event = EVENT_CONFIRM_DISCARD
  • trunk/hiptop/pester/net/sabi/pester/Alarm.java

    r287 r295  
    3131    // transient
    3232    private int mState;
    33     private int mAbsoluteFireTime; // only valid if periodic
     33    private int mAbsoluteFireTime; // valid if periodic and modified since reboot
    3434    private danger.app.Alarm mAlarm;
    3535    private int mUID;
     
    3939        mAlarm = new danger.app.Alarm(0, Application.getCurrentApp(), this);
    4040        mUID = 0;
     41        mAbsoluteFireTime = -1;
    4142    }
    4243
     
    8384        mDate = new Date();
    8485        mDate.addMinutes(minutes);
     86        mAbsoluteFireTime = Hardware.getAbsoluteTime() + (minutes * 60);
    8587        resume();
    8688    }
     
    121123            int alertID = dataStream.readInt();
    122124            mAlert = (alertID == 0 ? null : new RingToneObject(alertID));
     125            mAbsoluteFireTime = -1; // just in case
    123126        } catch (Exception e) {
    124127            // XXX do something
     
    152155        if (mState != STATE_SCHEDULED)
    153156            return;
    154         if (getUsesPeriod()) {
     157        if (getUsesPeriod() && mAbsoluteFireTime != -1) {
    155158            int realSecondsLeft = mAbsoluteFireTime - Hardware.getAbsoluteTime();
    156159            mDate = new Date();
     
    230233            else if (daysFromToday == 1)
    231234                dateString = "Tomorrow"; // XXX localize
    232             else if (daysFromToday < 7)
     235            else if (daysFromToday > 1 && daysFromToday < 7)
    233236                dateString = date.getDayString();
    234237            else
  • trunk/hiptop/pester/net/sabi/pester/AlarmListView.java

    r294 r295  
    6969            AlertWindow alert =
    7070                Application.getCurrentApp().getAlert(ID_DISCARD_ALERT, this);
    71             alert.setMessage("Permanently discard \u201c" +
    72                              alarm.getMessage() + "\u201d?"); // XXX localize
     71            alert.setMessage(StringFormat.withFormat(alert.getMessage(),
     72                                                     alarm.getMessage()));
    7373            alert.show();
    7474            return true;
     
    7979            ((Alarm)getFocusedItem()).resume();
    8080            return true;
    81         // XXX for EVENT_TIME_FORMAT_CHANGED, we also need to force a
    82         // full redraw (in addition to invalidating the tooltip)
     81        case Event.EVENT_TIME_FORMAT_CHANGED:
     82            invalidate();
    8383        case Event.EVENT_TIME_CHANGED:
    8484            if (mToolTipWindow == null || !mToolTipWindow.isVisible())
  • trunk/hiptop/pester/net/sabi/pester/Alarms.java

    r294 r295  
    5454    public static Alarms getList() {
    5555        if (sAlarmList == null) {
    56             Application.registerForEvent(sListener, Event.EVENT_TIME_CHANGED);
    5756            sSettingsDB = new SettingsDB("settings", true /* auto sync */);
    5857            sListener = new Listener();
    5958            new Alarms();
     59            Application.registerForEvent(sListener, Event.EVENT_TIME_CHANGED);
    6060        }
    6161        return sAlarmList;
Note: See TracChangeset for help on using the changeset viewer.