private void initCalendar() {
    // metodo q inicializa calendario

    // configura duas datas para limites, inicial e final
    Calendar initDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.MONTH, 2);

    // inicializa calendario apontando datas finais, iniciais e modo de selecao
    screenCalendar
        .init(initDate.getTime(), endDate.getTime())
        .inMode(CalendarPickerView.SelectionMode.SINGLE)
        .withSelectedDate(initDate.getTime());
    selectedDate = screenCalendar.getSelectedDate();
  }
  private void setCalendarListener() {
    screenCalendar.setOnDateSelectedListener(
        new CalendarPickerView.OnDateSelectedListener() {
          @Override
          public void onDateSelected(Date date) {
            selectedDate = date;
            if (selectedDateFreeProfessionalDTOSet != null) {
              selectedDateFreeProfessionalDTOSet.clear();
            }
            if (validateUtilDateAndProfessional(selectedDate, selectedProfessionalDTO)) {
              redirectToScheduleScreen();
            } else {
              startDownViewLoad();
              rearrangeAvailableProfesionals(selectedDate);
            }
            /*todo
            if(getSelectedProfessional != null && isAvaliableSelectedProfessional){
            //caso profissional esteja selecionado e o dia esteja disponivel para aquele prof
            } else {
            rearrangeProfessionalLV(selectedCal) metodo para reorganizar a listview de prof de acordo com o dia selecioando
            }

            */

          }

          @Override
          public void onDateUnselected(Date date) {}
        });
  }
  public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.fragment_cust_schedule_date_6_p, parent, false);
    networkConfig = new NetworkConfig(getActivity());

    initViews();
    startFullViewLoad();
    initCalendar();

    // configurando listeners
    // setInviteListener();
    setCalendarListener();
    if (screenCalendar.getSelectedDate() != null) {
      // startFullViewLoad();
      selectedDate = screenCalendar.getSelectedDate();
      retrieveContacts();
    }
    return v;
  }
  private void highlightDailyScheduleList(List<Calendar> freeCalendars) {
    // marca os dias livres e rearruma a lista de profissionais

    if (freeCalendars != null) {
      screenCalendar.clearHighlightedDates();

      professionalAdapter.clearAvailableMarks();
      professionalAdapter.removeMark(professionalLV.getCheckedItemPosition());
      System.out.println(professionalLV.getCheckedItemPosition());
      if (selectedDate != null) {
        // Toast.makeText(getActivity(), selectedProfessionalDTO.getName() + " não está livre no dia
        // selecionado.", Toast.LENGTH_LONG).show();
        clearSelectedDate();
      }
      Collection<Date> freeDatesCollection = new ArrayList<>();
      for (Calendar freeCalendar : freeCalendars) {
        freeDatesCollection.add(DateUtilMoti.convertCalendarToDate(freeCalendar));
      }
      screenCalendar.highlightDates(freeDatesCollection);
      if (freeDatesCollection.size() <= 0)
        Toast.makeText(getContext(), "Profissional sem dias livres", Toast.LENGTH_SHORT).show();
    }
    finishUpViewLoad();
  }
  private void highlightProfessionalDTOList(
      Set<ProfessionalDTO> availableProfessionalDTOs,
      Set<ProfessionalDTO> unavailableProfessionalsSet) {
    // limpa os dias marcados e profissional selecionado para mostrar profissionais disponiveis na
    // data selecionada

    for (ProfessionalDTO professionalDTO : availableProfessionalDTOs) {
      System.out.println("Nome: " + professionalDTO.getName());
    }
    if (selectedProfessionalDTO != null) {
      // Toast.makeText(getActivity(), selectedProfessionalDTO.getName() + " não está livre no dia
      // selecionado.", Toast.LENGTH_LONG).show();
      professionalLV.clearChoices();
      selectedProfessionalDTO = null;
    }
    professionalAdapter.highlightProfessionals(
        availableProfessionalDTOs, unavailableProfessionalsSet);
    if (selectedProfFreeCalendars != null) selectedProfFreeCalendars.clear();
    screenCalendar.clearHighlightedDates();
    finishDownViewLoad();
  }
 private void clearSelectedDate() {
   if (selectedDate != null) {
     screenCalendar.unselectDate(selectedDate);
     selectedDate = null;
   }
 }