aminography / PrimeDatePicker

PrimeDatePicker is a tool that provides picking a single day, multiple days, and a range of days.
Apache License 2.0
472 stars 52 forks source link

Is it possible to set multiple pre-selected dates in PrimeCalendar? #52

Closed parsamlm closed 3 years ago

parsamlm commented 3 years ago

Hello again Amin, I wanna know if it possible to set multiple pre-selected dates in PrimeCalendar or not. (this is my code which I try to do this)

List<PrimeCalendar> calendarList = new ArrayList<>(); if (taskList.size() > 0){ for (int i = 0; i < taskList.size(); i++){ int year = Integer.parseInt(taskList.get(i).getDate().substring(0, 4)); int month = Integer.parseInt(taskList.get(i).getDate().replaceAll("-", "/").substring(5, 7)); int day = Integer.parseInt(taskList.get(i).getDate().replaceAll("-", "/").substring(8, 10)); PrimeCalendar primeCalendar = new CivilCalendar(); primeCalendar.setDate(day); month = month - 1; primeCalendar.setMonth(month); primeCalendar.setYear(year); calendarList.add(primeCalendar); } } binding.calendarCalendarFragment.setPickedMultipleDaysList(calendarList);

parsamlm commented 3 years ago

could you please help me with this if it's possible? thank you

aminography commented 3 years ago

Hi Parsa, Sorry for delay. Yes, there is no problem to set a list of days as pre-selected. The point is that you should set it before showing the fragment. Unfortunately, I can't infer what was the problem with it in your code. (because of accessing via binding) Please share more related code. Thanks.

parsamlm commented 3 years ago

Do you mean that I should set it in onCreateView? and What method I should use to set a list of days as pre-selected?(is it setPickedMultipleDaysList( ) ?) thank you.

parsamlm commented 3 years ago

Problem Solved, Thanks.