예제 #1
0
 public void onTimeSet(
     android.widget.TimePicker view, int selectedHour, int selectedMinute) {
   hour = selectedHour;
   minute = selectedMinute;
   time.updateTime(hour, minute);
   AfterTimeSet();
 }
예제 #2
0
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   switch (id) {
     case TIME_DIALOG_ID:
       ((TimePickerDialog) dialog).updateTime(mHour, mMinute);
       break;
     case DATE_DIALOG_ID:
       ((DatePickerDialog) dialog).updateDate(mYear, mMonth, mDay);
       break;
   }
 }
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {

    // Restoration of title field
    if (savedInstanceState.containsKey(STATE_TITLE)) {
      String title = savedInstanceState.getString(STATE_TITLE);
      titleEditText.setText(title);
    }

    // Restoration of description field
    if (savedInstanceState.containsKey(STATE_DESCRIPTION)) {
      String description = savedInstanceState.getString(STATE_DESCRIPTION);
      descriptionEditText.setText(description);
    }

    // Restoration of time field
    if (savedInstanceState.containsKey(STATE_TIME_HOUR)
        && savedInstanceState.containsKey(STATE_TIME_MINUTES)) {
      int hour = savedInstanceState.getInt(STATE_TIME_HOUR);
      int minutes = savedInstanceState.getInt(STATE_TIME_MINUTES);
      time = new Pair(hour, minutes);
      setTime(hour, minutes);
      if (timePicker == null) {
        setTimePicker(hour, minutes);
      } else {
        timePicker.updateTime(hour, minutes);
      }
    }

    // Restoration of week days field
    if (savedInstanceState.containsKey(STATE_WEEK_DAYS)) {
      weekDays = savedInstanceState.getBooleanArray(STATE_WEEK_DAYS);
      if (weekDays != null) {
        for (int i = 0; i < weekDays.length; i++) {
          LinearLayout dayLayout = getDayLayout(i);
          if (weekDays[i]) {
            activateDay(i, dayLayout, false);
          } else {
            deactivateDay(i, dayLayout, false);
          }
        }
      }
    }

    // The call to super method must be at the end here
    super.onRestoreInstanceState(savedInstanceState);
  }
  @Override
  protected void onPrepareDialog(int id, Dialog dialog) {
    switch (id) {
      case TIME_DIALOG_ID:
        ((TimePickerDialog) dialog)
            .updateTime(mCalendar.get(Calendar.HOUR_OF_DAY), mCalendar.get(Calendar.MINUTE));
        break;
      case DATE_DIALOG_ID:
        ((DatePickerDialog) dialog)
            .updateDate(
                mCalendar.get(Calendar.YEAR),
                mCalendar.get(Calendar.MONTH),
                mCalendar.get(Calendar.DAY_OF_MONTH));
        break;

      case DIALOG_MULTIPLE_CATEGORY:
        final AlertDialog alert = (AlertDialog) dialog;
        final ListView list = alert.getListView();
        // been
        // selected, then uncheck
        // selected categories
        if (mVectorCategories.size() > 0) {
          for (String s : mVectorCategories) {
            try {
              // @inoran fix
              if (list != null) {
                list.setItemChecked(mCategoryLength - Integer.parseInt(s), true);
              }
            } catch (NumberFormatException e) {
              log("NumberFormatException", e);
            }
          }
        } else {
          if (list != null) {
            list.clearChoices();
          }
        }

        break;
    }
  }
예제 #5
0
 /* (non-Javadoc)
  * @see android.app.Activity#onPrepareDialog(int, android.app.Dialog)
  */
 @Override
 protected void onPrepareDialog(int id, Dialog dialog) {
   if (DIALOG_ID_ALARM_TIME == id && null != alarmTime) {
     ((TimePickerDialog) dialog).updateTime(alarmTime.getHourOfDay(), alarmTime.getMinutes());
   }
 }