CosmoCalendar icon indicating copy to clipboard operation
CosmoCalendar copied to clipboard

select just a single day

Open openmotion opened this issue 7 years ago • 2 comments

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

openmotion avatar Jan 10 '18 16:01 openmotion

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

LaxmanDroid avatar Apr 24 '19 05:04 LaxmanDroid

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", ""));

    })

amerelsayed1 avatar Apr 05 '20 19:04 amerelsayed1