@Override
  public void onDateRePicker(double which, int year, int month, int day) {
    Calendar calendar = Calendar.getInstance();
    calendar.set(year, month, day);
    // Make sure the dates picked were not in the past
    //        if (calendar.before(Calendar.getInstance()))
    //            ApplicationHelper.toastShort(getApplicationContext(), "The date picked cannot be
    // before today");
    /*else*/ switch ((int) which) {
      case 1: // Start date
        start = calendar;
        if (end != null) {
          if (start.before(end))
            textStartDate.setText("Pick Up on\n" + ApplicationHelper.printDateCalendar(start));
          else {
            end.setTimeInMillis(start.getTimeInMillis());
            end.add(Calendar.DAY_OF_MONTH, 2);
            textStartDate.setText("Pick Up on\n" + ApplicationHelper.printDateCalendar(start));
            textEndDate.setText("Drop off on\n" + ApplicationHelper.printDateCalendar(end));
          }
          setCost(2, "");
        } else {
          DialogFragment newFragment =
              TimePickerFragment.newInstance(
                  1, start.get(Calendar.HOUR_OF_DAY), start.get(Calendar.MINUTE));
          newFragment.show(getFragmentManager(), "startTimePicker");
        }
        break;

      case 2: // End date
        // Change the calendar time to 0, so that the user cannot choose the end date as the same
        // date as the start date
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 1);
        if (calendar.after(start)) {
          end = calendar;
          // Send the end time to the same of that of the start time
          end.set(Calendar.HOUR_OF_DAY, start.get(Calendar.HOUR_OF_DAY));
          end.set(Calendar.MINUTE, start.get(Calendar.MINUTE));
          end.set(Calendar.SECOND, start.get(Calendar.SECOND));
          end.set(Calendar.MILLISECOND, start.get(Calendar.MILLISECOND));
          // Display the date and time
          textEndDate.setText("Drop Off on\n" + ApplicationHelper.printDateCalendar(calendar));
          textEndTime.setText("Drop Off at\n" + ApplicationHelper.printTimeCalendar(end));
          // Adjust the cost
          setCost(2, "");
        } else { // The end date selected was before the start date
          ApplicationHelper.toastShort(getApplicationContext(), "Select Date After the Start Date");
        }
        break;
    }
  }