@Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   // save controls state
   outState.putString("subject", edSubject.getText().toString());
   outState.putBoolean("alarm", chkAlarm.isChecked());
   outState.putLong("dateStart", dateStart.getTimeInMillis());
   outState.putBoolean("allday", chkAllDay.isChecked());
   outState.putInt("repeatType", iRepeatType);
   outState.putInt("repeatEvery", iRepeatEvery);
   outState.putLong("dateEndOn", dateEndOn.getTimeInMillis());
 }
 @Override
 public boolean DateValuesChanged(Bundle data) {
   super.DateValuesChanged(data);
   if (GetStartMode() == StartMode.EDIT) {
     if (dateStart.getTimeInMillis() != data.getLong("dateStart")) return true;
   }
   return false;
 }
  public void SaveData() {
    // check date if no repeat
    if ((iRepeatType == 0) && (DateBeforeNow(dateStart))) return;

    dataRow.SetSubject(edSubject.getText().toString());
    dataRow.SetStartDate(dateStart);
    dataRow.SetAllDay(chkAllDay.isChecked());
    dataRow.SetAlarm(chkAlarm.isChecked());

    // set repeat type
    RepeatData rd = dataRow.GetRepeat();
    rd.SetRepeatTypeAsInt(iRepeatType);
    rd.SetEvery(iRepeatEvery);
    rd.SetEndOnDate(dateEndOn.getTimeInMillis());

    if (SaveDataToTable(dataTable)) CloseActivity(dataTable);
  }
 private String GetRepeatInfo() {
   String s = utils.GetResStr(R.string.strRepeatTypeNone);
   String sUntil = utils.GetResStr(R.string.strRepeatInfoUntil);
   String sEndDate =
       (dateEndOn.getTimeInMillis() == 0)
           ? ""
           : " " + sUntil + " " + AnCalDateUtils.formatMediumDate(this, dateEndOn);
   // daily
   if (iRepeatType == 1)
     s = String.format(utils.GetResStr(R.string.strRepeatInfoDaily), iRepeatEvery, sEndDate);
   // weekly
   if (iRepeatType == 2)
     s = String.format(utils.GetResStr(R.string.strRepeatInfoWeekly), iRepeatEvery, sEndDate);
   // monthly
   if (iRepeatType == 3)
     s = String.format(utils.GetResStr(R.string.strRepeatInfoMonthly), iRepeatEvery, sEndDate);
   // monthly
   if (iRepeatType == 4)
     s = String.format(utils.GetResStr(R.string.strRepeatInfoYearly), sEndDate);
   return s;
 }
 public void OpenRepeatDialog() {
   ActivityAppointmentRepeat.OpenRepeatForEdit(
       this, bundleOtherDataStartup, iRepeatType, iRepeatEvery, dateEndOn.getTimeInMillis());
 }