ApplikeySolutions / CosmoCalendar

📅 CosmoCalendar is a fully customizable calendar with a wide variety of features and displaying modes.
https://applikeysolutions.com
MIT License
1.62k stars 288 forks source link

select just a single day #34

Open openmotion opened 6 years ago

openmotion commented 6 years ago

hello by default we can select one or more days, how can i limit to a single day ? thanks

LaxmanDroid commented 5 years ago

use this piece of code : calendarView.setSelectionType(SelectionType.SINGLE);

amerelsayed1 commented 4 years ago

To handle single Click

calendarView.selectionManager = SingleSelectionManager(OnDaySelectedListener { Log.e(" CALENDAR ", "========== setSelectionManager =========="); Log.e(" CALENDAR ", "Selected Dates : " + calendarView.selectedDates.size); if (calendarView.selectedDates.size <= 0) return@OnDaySelectedListener; val spf = SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH) reservationTime = spf.format(calendarView.selectedDays[0].calendar.time) // Log.e(" CALENDAR ", "Departure : DD MMM YYYY : " + formatDateToString(calendarView.getSelectedDays().get(0).getCalendar().getTime(), "dd MMM yyyy", "")); // Log.e(" CALENDAR ", " Return : DD MMM YYYY : " + formatDateToString(calendarView.getSelectedDays().get(calendarView.getSelectedDates().size() - 1).getCalendar().getTime(), "dd MMM yyyy", ""));

    })