question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Want Vertical Scroll on month view to switch to week view and vice versa

See original GitHub issue

Hi, I’m trying to implement switching from week view to month view and vice versa on vertical scroll I implemented the same by using the parent scroll view in but I want the switching to happen only on scrolling inside the calendar view not on the whole layout. Following is my code for implementing my requirement in parent scroll view Thanks

weekCalendarView.isVisible = false
scrollView.setOnScrollChangeListener(View.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
            val x = scrollY - oldScrollY
            if (x > 0) {
                //scroll down
                //week to month
                monthCalendarView.isVisible = false
                weekCalendarView.requestLayout()
                weekCalendarView.scrollToDate(selectedDate!!)
                weekCalendarView.isVisible = true
            }
            if (x < 0) {
                //scroll up
                //month to week
                    weekCalendarView.isVisible = false
                    monthCalendarView.requestLayout()
                    monthCalendarView.scrollToMonth(selectedDate!!.yearMonth)
                    monthCalendarView.isVisible = true
            }
        })

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kizitonwosecommented, Oct 21, 2022

If your solution is already working properly but you need it to happen outside the calendar view, then you can:

  • set a touch listener on the scroll view.
  • when touch down is recorded, check if it is within the bounds of the calendar.
  • if it is not, set a variable to true, else set it to false.
  • In your scroll listener, only toggle week mode if the variable is true.
0reactions
kizitonwosecommented, Oct 30, 2022

There are some things wrong in your code like setting view visibility, and calling scrollToMonth() inside updateLayoutParams(). You have to figure out what you are not doing right. The previous discussions should guide you as I cannot provide specific help without access to the app code to see what exactly is happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scroll google calendar month view one week at a time, to ...
Pressing w switches to 1-week view, then pressing p or n steps back (previous) or forward (next) 1 week, then pressing x switches...
Read more >
Google preps vertical scrolling in Calendar's month view
The new interface aligns more closely with the schedule view that scrolls vertically, too, and might thus make navigating months more intuitive.
Read more >
Video: Calendar views - Microsoft Support
Training: In this video, learn how to get a handle on your schedule by changing your calendar view and even your minimum meeting...
Read more >
How to change Month View to Week View vice versa for ...
In a weekView mode, it has 1 row. So when you want to change the mode you change numberOfRows and reload calendarView and...
Read more >
Calendar Vertical Scroll? - Google Help
It's not such a big deal to me because I typically keep my calendar in the week view and only rarely need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found