Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll by week instead of day #31

Open
florianhenonin opened this issue Feb 9, 2017 · 24 comments
Open

Scroll by week instead of day #31

florianhenonin opened this issue Feb 9, 2017 · 24 comments

Comments

@florianhenonin
Copy link

As Google Agenda, should it be possible to scroll by week instead of day ?

Thank you for your work.

@jhoobergs
Copy link
Member

@florianhenonin Maybe we can make it more general to allow people to set the amount of days to scroll at once. I think for instance it can be great to scroll by the same amount of days as the amount of visible days.

Would you like to work on it ?

@florianhenonin
Copy link
Author

florianhenonin commented Feb 9, 2017

This would be awesome !

I would love work on it but unfortunately can't for now...
Maybe in a few month.

@wietsebuseyne
Copy link

Just a quick idea, maybe the view should only have a day-view and multiple-days view where it is just a tableview (~Google Agenda). Then a viewpager can be used to show multiple of these views. I think this would benefit the simplicity of the view (only show 1 day) and scrolling (would also be automatically by the number of selected days). This is however a big refactor.

@florianhenonin
Copy link
Author

I'm currently using ViewPager to do that but it's not enough efficient.
On iOS I'm using Calendar which is very fast.

@jhoobergs
Copy link
Member

Letting the library create multiple days itself, is much more efficient. It's not really a big change to change the amount of scrolled days in the current code.

@wietsebuseyne
Copy link

That's true. Maybe the horizontal scrolling can also be adjusted to resemble more the behavior of Google Calendar (at least when scrolling by week), i.e. snap to the next week and don't scroll multiple weeks at once?

@jhoobergs
Copy link
Member

You can use the xScrollingSpeed attribute to adapt the horizontal behaviour. In some circumstances it's nice to scroll multiple weeks at once.

@wietsebuseyne
Copy link

True, but setting it too low causes the view not to scroll sometimes when it would be desired while still scrolling multiple days when scrolling fast. Also, scrolling slowly does not always trigger the scrolling immediately for me which can cause the view snapping to the same day again. For my usecase it was needed to scroll one day at a time so I disabled scrolling of the view and implemented a non-interactive scroller on top of it that consumes any horizontal swipe and sets the date of the view to the next/previous.

This is why I was thinking about a scrolling behavior that lets the view always snap to its next/previous period, but I understand it might not be something a lot of people need.

Anyway thanks for all the great work of this awesome view :) looking forward to its new features

@jhoobergs jhoobergs reopened this Nov 18, 2017
@jhoobergs
Copy link
Member

It would be nice if someone adds the feature to automatically scroll by the amount of days that is currently being shown 😉

@SkyleKayma
Copy link

SkyleKayma commented Nov 29, 2017

Ok, so I have done a weekview that scroll 7 days by 7 days. It's working exactly like it is needed.
I will do a PR when the code I have will be better organized.

To explain : Actually it only allows scrolling week by week (or 7 days by 7 days, I want to say that it could be another day than Monday in first day of the 7days). I will write it more genericly.

Edit: If you really need this feature and can't wait for PR, you can find fork here : https://github.com/openium/Android-Week-View
DON'T FORGET that this still a beta feature and there is probably bugs that I didn't saw for the moment.
The tips to make it work is : Use the temp WeekViewAdvanced, and then call goToDate() to make it start the day you want (a Monday to scroll Monday by Monday, ...)

@nivritgupta
Copy link

@SkyleKayma will you please share the code how you done the functionality Swipe week by week . or 7 days by 7 days

@SkyleKayma
Copy link

SkyleKayma commented Dec 9, 2017

I will. Not really the time to do it actually, so I linked the forked project for the moment. But keep connected, it will be done in some days. (See edited message before)

Edit: I have edited message before, I have pushed the lasted version I have actually just now.

@nivritgupta
Copy link

ok Thanks let me check your forked project

@nivritgupta
Copy link

@SkyleKayma I tried with your code to achieve the week by week view functionality but its not working ,did you get a chance to working on this project ?

@SkyleKayma
Copy link

SkyleKayma commented Jan 5, 2018

Yeah I get a chance today to work on it again, and I have a working WeekView with some new features:

  • You can scroll by the amount of days you want, includes :
    • fling only scroll to next "amount of days" you wanted
  • There was a problem that when you wanted to scale, the view scrolled on X axis too. There was no option that prevent to scroll X axis when you are scaling.
  • A "prevent fail scrolling" feature, it's a little distance that you can scroll "safely".
    Ex: Let's say that the view only scrolls at 50pixels when it is 800pixels wide, so let's say that the "SafeZone" is 100pixels, so we will not move to the next week because the scroll was not "significant" enough. It's atleast a good feature that is actually activated by default, But I will make it configurable.

And some other usefull functions that I needed in my own project so I had them, like get the Height of the weekView WITHOUT the header size.
Ex: I needed to show by default 8h to 20h, but the lib only allow to define the first one.
So I called my new function, and divide the size I get by the number of hour to show (here 12 -> 20-8) to get the "hourHeight" to define.
And THEN call goToHour to set it to 8h. =]

The code is by far more clean than before, so I will do PR this WE probably. After that I will need to talk to @jhoobergs to know if it's ok to have a new WeekView (Here called WeekViewAdvanced) that inherit the first one or if we can combine the two in the first one.

I pushed the new modification on the github project link before.

TestVideo.zip

@jhoobergs
Copy link
Member

@SkyleKayma Nice.
It would be best if it can be combined into 1 class.

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 6, 2018

@SkyleKayma Can you please do a pull request?

@SkyleKayma
Copy link

Allready done. Never ended.

@AndroidDeveloperLB
Copy link

@SkyleKayma You did? Where? And how come yours don't have this issue:
#94
?

@SkyleKayma
Copy link

I started it here :
#68
But at this moment, I was just starting Android dev. I could do a lot better today..

Someone tried to take my work again to do something with :
#88

In fact there is some functions that I had here, and never put in my PR. So if you have the time to do this, you can.

@AndroidDeveloperLB
Copy link

Which functions? Also, I think what I wrote was of a different repository, so it means I didn't test yours.

@SkyleKayma
Copy link

SkyleKayma commented May 6, 2018

My PR just allow the scroll week by week. That's all.
Here, I had the "safe scroll" (You started to scroll but it was not enough so it came back to the actual selected week, just like any calendar app), and a fix to prevent the "zooming" action to scroll on X axis.

@AndroidDeveloperLB
Copy link

I've tested his code. Seems to work, but it has an issue:
If you scroll while it is snapping, it won't snap well.
See attached video:
device-2018-05-07-120729.zip

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 7, 2018

I've prepared a pull request that contains those changes, together with some fixes of issues I've found, and conversion to 100% Kotlin code :
#97 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants