memfis19 / Cadar

Android solution which represents month and list calendar views.
MIT License
360 stars 48 forks source link

Interaction between Month Calendar and List Calendar #5

Closed Abdullah-Nasim closed 7 years ago

Abdullah-Nasim commented 7 years ago

I have noticed that when I click on some day like 18th of Dec 2016 on the month calendar the list calendar shows me the week starting from 19 Dec and the 18th get hidden on top. So the month calendar and the list calendar should be synchronized perfectly. How can I do that ?

Abdullah-Nasim commented 7 years ago

Essentially the difference is of one week between month calendar and list calendar. When I click on 19th Dec in month calendar it shows me the correct week in list calendar but when I click on 20th Dec it scrolls to 26th of Dec in List Calendar which is wrong, it should stay to the week range 19 - 26 of Dec.

memfis19 commented 7 years ago

Hi, I'll take a look and fix it asap.

memfis19 commented 7 years ago

Sorry, I can't reproduce this issue. Can you send me your piece of code when you interact between calendars?

Abdullah-Nasim commented 7 years ago

monthCalendar.setOnDayChangeListener(new OnDayChangeListener() { @Override public void onDayChanged(Calendar calendar) {

            listCalendar.setSelectedDay(DateUtils.setTimeToMidnight((Calendar) calendar.clone()), false);
        }
    });
    monthCalendar.setOnMonthChangeListener(new OnMonthChangeListener() {
        @Override
        public void onMonthChanged(Calendar calendar) {

            listCalendar.setSelectedDay(DateUtils.setTimeToMonthStart((Calendar) calendar.clone()), false);            }
    });
Abdullah-Nasim commented 7 years ago

The code is same as your sample app.

Abdullah-Nasim commented 7 years ago

The problem in in scroll position of the recyclerview please find below the attached example. screenshot_20161208-155452

So I have clicked on 12th of April but the starting day in listCalendar is 16th of April which is wrong. The scroll position should be one step up.

memfis19 commented 7 years ago

Thanks. I got it. :)

memfis19 commented 7 years ago

Fixed in 0.2.0.