NED-University / Smart-Pill-Reminder

MIT License
0 stars 1 forks source link

FromDate not being set properly #15

Closed Inshal240 closed 9 years ago

Inshal240 commented 9 years ago

The FromDate variable does not change in the EditAlarm activity. This is also reflected in the FromDate TextView. The changes however are made in the dialog box's event handler shown below. The mAlarm class's mFromDate member and the EditAlarm activity's fromdatetextView do not change however (as the latter is dependent on the former). This might be related to issue #14.

fromdateText.setText(mDateTime.formatFromDate(mAlarm));
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;

            mCalendar = new GregorianCalendar(mYear, mMonth, mDay, mHour, mMinute);
            mAlarm.setFromDate(mCalendar.getTimeInMillis());

            updateButtons();
        }
 };
Inshal240 commented 9 years ago

The values for FromDate and ToDate must be greater than the current time, that is, some time in the future. Past values will not be accepted. Setting FromDate to three days ago (or even a minute ago) will cause the alarm to be taken as outdated. This solution closes #14 as well.