blazsolar / android-collapse-calendar-view

Android calendar view that can be toggled between week and month view.
MIT License
628 stars 207 forks source link

How can we manually trigger expand or collapse calendarView #8

Open aftabsikander opened 9 years ago

aftabsikander commented 9 years ago

I am unable to find any function which can help me manually trigger expand or collapse view. I looked at the source code. I believe Resize manager is the main class which handles expand or collapse functionality. And it take touch events to trigger the function. Can you by pass the touch function to achieve this functionality.

tuckercr commented 7 years ago

This was my attempt to close the monthly view when a date is selected, but for some weird reason it only works every other time. Still trying to figure out why.

 mCalendarView.setListener(new CollapseCalendarView.OnDateSelect() {
        @Override
        public void onDateSelected(LocalDate date) {

            if (mCalendarView.getManager() != null) {

                CalendarManager.State state = mCalendarView.getManager().getState();

                if (state == CalendarManager.State.MONTH) {
                    mCalendarView.getManager().toggleView();
                }
            }
        }
 });