alamkanak / Android-Week-View

Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Apache License 2.0
3.42k stars 1.23k forks source link

Weekly event and weekly scrolling #11

Closed emanueleDiVizio closed 10 years ago

emanueleDiVizio commented 10 years ago

I couldn't get to create weekly event, probably because an onWeekChangeListener is not implemented. My suggestion is to implement a method to scroll from week to week (From monday to monday), an onWeekChangeListener to populate the weekView and a method to start the week from a preferred day, other than today. Thanks a lot

alamkanak commented 10 years ago

A week change listener will not be a robust solution because when switching from a week to the next, the events from both the weeks should be visible (last day of the first week and first day of the next week). Also loading data for each week will result laggy animation. What you can do is you can implement onMonthChangeListener and set the number of visible days to 7.

If you are looking for a scrolling solution where it cannot be stopped in any day other than Monday, then I am sorry to say this feature has not been implemented yet. When this scrolling feature is available in the future, you will still have to implement onMonthChangeListener.

AndroidDeveloperLB commented 6 years ago

Any news about this feature? Was it added eventually?

If not, maybe this could be helpful for this feature: https://stackoverflow.com/q/47514072/878126 ? EDIT: seems this library uses a single view that draws everything in a customized way. This won't help.

CTKnight commented 6 years ago

This is a feature in my app, I use a work around:

  1. Modify the source of week view and disable horizontal swipping in the view(this part is not in my fork)

  2. Place a weekview per fragment set it to display 7 days events, use a fragment page adapter to achieve smooth horizontal swipping.

AndroidDeveloperLB commented 6 years ago

@CTKnight This won't work well, because swiping between them will also swipe the hours, and in addition, the hours might be different between pages. I've found this fork which does it well , without ViewPager : https://github.com/openium/Android-Week-View

But for some reason he didn't do a pull request. I've tested it and so far the only issue with it seems to be that he created a new class that extends WeekView instead of putting the new code in WeekView .

CTKnight commented 6 years ago

@AndroidDeveloperLB you are right, extra efforts can be made to align hours if you use view pager (that's the part I leave for my teammates XD). My solution also creates a new class. This can't painless, for weekview doesn't leave much space to customize though.

AndroidDeveloperLB commented 6 years ago

@CTKnight I don't like the implementation here of WeekView, but it's just the only decent library I've found. Here all that's drawn in a flat view that handles all and has 2000+ lines, making it hard to modify and understand.

Google Calendar app, for example, does use ViewPager and in fact multiple views in it. I've found it in the DDMS tool. I wanted to do it myself, but it just takes too much time, so I was instructed to use what I can find.

The library here has many issues that I've found: