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

Refactor editing, coalese Alarms and alarm list. Try (and fail) to recognize exit from alarm time editor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hiptop/pester/net/sabi/pester/Alarm.java

    r249 r250  
    2121    private String mMessage;
    2222    private int mType;
    23     private int mInterval; // XXX rename to 'interval'
     23    private int mPeriod;
    2424    private Date mDate;
    2525    private RingToneObject mAlert;
     
    3838    }
    3939    public int getPeriod() {
    40         return mInterval;
     40        return mPeriod;
    4141    }
    4242    public boolean getUsesPeriod() {
     
    5858    public void setPeriod(int period, boolean repeating) {
    5959        mType = repeating ? TYPE_PERIODIC_REPEATING : TYPE_PERIODIC;
    60         mInterval = period;
     60        mPeriod = period;
    6161    }
    6262    public void setDate(Date date) {
     
    7575            dataStream.writeByte(VERSION_1);
    7676            dataStream.writeUTF(mMessage);
    77             dataStream.writeInt(mInterval);
     77            dataStream.writeInt(mPeriod);
    7878            dataStream.writeInt(mDate.getUnixTimeGMT());
    7979            dataStream.writeInt(mType);
     
    9696            }
    9797            mMessage = dataStream.readUTF();
    98             mInterval = dataStream.readInt();
     98            mPeriod = dataStream.readInt();
    9999            mType = dataStream.readInt();
    100100        } catch (Exception e) {
     
    128128        if (getUsesPeriod()) {
    129129            mDate = new Date();
    130             mDate.addSeconds(mInterval);
     130            mDate.addSeconds(mPeriod);
    131131        }
    132132        resume();
     
    154154        switch (mType) {
    155155        case TYPE_PERIODIC:
    156             sb.append("periodic (").append(mInterval).append("s) "); break;
     156            sb.append("periodic (").append(mPeriod).append("s) "); break;
    157157        case TYPE_PERIODIC_REPEATING:
    158             sb.append("repeating periodic (").append(mInterval).append("s) ");
     158            sb.append("repeating periodic (").append(mPeriod).append("s) ");
    159159            break;
    160160        case TYPE_DATE:
     
    170170            return null;
    171171        String layout = LocaleUtils.getDateTimePattern();
    172         String timeFormat = LocaleUtils.getMediumTimeFormat();
    173172        String dateFormat = LocaleUtils.getMediumDateFormat();
    174         String timeString = DateFormat.withFormat(timeFormat, date);
    175         String dateString = DateFormat.withFormat(dateFormat, date);
     173        String dateString;
     174        String timeFormat;
    176175        if (relative) {
     176            timeFormat = LocaleUtils.getShortTimeFormat();
    177177            int daysFromToday = date.getDaysBetween(new Date());
    178178            if (daysFromToday == 0)
     
    182182            else if (daysFromToday < 7)
    183183                dateString = date.getDayString();
    184         }
     184            else
     185                dateString = DateFormat.withFormat(dateFormat, date);
     186        } else {
     187            dateString = DateFormat.withFormat(dateFormat, date);
     188            timeFormat = LocaleUtils.getMediumTimeFormat();
     189        }
     190        String timeString = DateFormat.withFormat(timeFormat, date);
    185191        return StringFormat.withFormat(layout, timeString, dateString);
    186192    }
Note: See TracChangeset for help on using the changeset viewer.