Comments (31)
Thats because your onMonthScroll() -method. Can you post your code?
from compactcalendarview.
I have an asyncTask calling webservice to get the eventList for every month
from compactcalendarview.
Hi, can you post some sample code of you onMonthScroll listener? Is there actuall lag when scrolling or is the scrolling too rigid?
from compactcalendarview.
I think he means that the scrolling is too rigid. I've the same user experience, I am used to the ViewPager
swiping (a fast swipe is sufficient, I don't have to dag from start to end for example)
from compactcalendarview.
Thanks that makes sense, will look at OverScroller documentation and see what I can find.
from compactcalendarview.
I think we'll need VelocityTracker for this. Take a look at this: http://www.devexchanges.info/2015/03/create-snapping-horizontal-scroll-view.html
from compactcalendarview.
If any one is interested there is some code changes in a branch. It would be good to get some feedback on how it feels. It should work very simialr to the one Google calendar. Simply checkout the project, run the sample and have a play around with the scrolling.
from compactcalendarview.
I've tested and I can confirm that it feels just like the Google Calendar (or any ViewPager). Only the onDayClick
is broken now (I've tested it in the toolbar).
If you need more feedback I've a list:
- Lowering the
minSdkVersion
to 14. (My project depends onminSdkVersion
14) compileSdkVersion
can be 23,buildToolsVersion
can be 23.0.2 andtargetSdkVersion
can be 23- If the above is done then it's possible to
compile 'com.android.support:appcompat-v7:23.1.1'
- Week numbers before the week (just like Google Calendar) if the screen width is
wide enough:
- Make a option to auto re-size (
onMeasure
) when a month is scrolled so that the height of the calendar view equals the current month (for example the height of February 2016 can be smaller by one row) - Show only a range of dates (#37) and use use the
springBack()
method inOverScroller
, which returns the previous month to the normal coordinate range in case it went out of bounds.
Thanks for the great library!
from compactcalendarview.
Only the onDayClick is broken now (I've tested it in the toolbar).
Yep will have a look, I wanted to make sure people are happy with the scrolling now.
Lowering the minSdkVersion to 14. (My project depends on minSdkVersion 14)
compileSdkVersion can be 23, buildToolsVersion can be 23.0.2 and targetSdkVersion can be 23
Should be easy enough.
Week numbers before the week (just like Google Calendar) if the screen width is wide enough:
Interesting, I havn't seen this on my phone. And im using a phone with a high res, is that using a tablet or something?
Make a option to auto re-size (onMeasure) when a month is scrolled so that the height of the calendar view equals the current month (for example the height of February 2016 can be smaller by one row)
Never been a fan of that. So I never added it, but if enough people want it. I can do it.
Show only a range of dates (#37) and use use the springBack() method in OverScroller, which returns the previous month to the normal coordinate range in case it went out of bounds.
Will have a look at that as well since people seem to want ti.
So theres a few issues that need to be raised as a result I think. Will do so when I get time.
from compactcalendarview.
Interesting, I havn't seen this on my phone. And im using a phone with a high res, is that using a tablet or something?
I'm using a Nexus 5 with Android 6.0.1 (maybe it's only on Marshmallow but I'm not sure). My Google Calendar version is: 5.3-108865406-release
Never been a fan of that. So I never added it, but if enough people want it. I can do it.
I'm also not a fan of it, but I think some people want the same behavior as the Google Calendar.
Take your time!
from compactcalendarview.
I discovered some bugs:
With the latest version:
onDayClick
is working but the snapping is broken if we do a 'long' duration swipe.
With the previous version:
- If we doing a 'long' duration swipe from the end to start (so that the next month is visible) it snaps still on the previous month.
On all versions:
- If we are setting the current date (
setCurrentDate(new Date()
); the current date is also visible in the same month on the year 2014, 2016 etc. (it looks like theCalendar.YEAR
is not checked or forgotten)
from compactcalendarview.
With the latest version:
onDayClick is working but the snapping is broken if we do a 'long' duration swipe.
With the previous version:If we doing a 'long' duration swipe from the end to start (so that the next month is visible) it snaps still on the previous month.
These should now be fixed. I've made some changes that seem good to me in my initial testing. Have a go and let me know your thoughts. Thanks for the feedback so far.
On all versions:
If we are setting the current date (setCurrentDate(new Date()); the current date is also visible in the same month on the year 2014, 2016 etc. (it looks like the Calendar.YEAR is not checked or forgotten)
This is actually a feature of Google calendars, so I did the same thing.
from compactcalendarview.
Scrolling is completely broken now, I implemented the test branch and also tried your sample code and have confirmed you can't scroll.
from compactcalendarview.
Sorry about that, I had made some slight re-factoring and didn't run the sample before assuming it would work 😩. Try again now, I've run the sample and tested it.
As far as I can see, the only thing that needs to be changed is that if the user has scrolled slowly to the end of the current calendar, it snaps back rather than scroll to the next. However, this shouldn't be too difficult to fix I don't think.
from compactcalendarview.
Awesome, It's working great now thanks! I'll investigate the snap back when slowly scrolling and I'll keep you updated.
from compactcalendarview.
This is actually a feature of Google calendars, so I did the same thing.
My Google Calendar doesn't show this 'feature' see this:
I discovered some bugs with the latest version:
If we press on day, it first selects the first day of the month and then the day we clicked on (I don't know if this was also in the previous version, I just discovered this while testing the onDayClick
, it looks like the onMonthScroll
gets first called if we touch something):
And the bug that has been discussed here before (scroll slowly to the end of the current calendar, it snaps back rather than scroll to the next):
(Sorry for the many animated gifs, I thought that this would help to clarify)
from compactcalendarview.
Thanks for the gifs, very helpful.
This is actually a feature of Google calendars, so I did the same thing.
My Google Calendar doesn't show this 'feature' see this:
Interesting, when I was developing the initial calendar, it was how it worked. I guess maybe they changed it or I may have been mistaken. Either way, we need to also check the year before drawing the indicator which should fix the problem.
If we press on day, it first selects the first day of the month and then the day we clicked on (I don't know if this was also in the previous version, I just discovered this while testing the onDayClick, it looks like the onMonthScroll gets first called if we touch something):
Nice catch there, looks like a bug. The onMonthScroll should not be called. I'll update the unit tests to verify its not called on when a day is selected and fix the bug. Looks like I didn't notice it on my device maybe because it renders things too fast. I will pick this up today probably because I have some time.
And the bug that has been discussed here before (scroll slowly to the end of the current calendar, it snaps back rather than scroll to the next):
Thanks, for clarifying with a gif :).
from compactcalendarview.
If we press on day, it first selects the first day of the month and then the day we clicked on (I don't know if this was also in the previous version, I just discovered this while testing the onDayClick, it looks like the onMonthScroll gets first called if we touch something):
I've updated the code to fix this problem and added some android instrumentation tests for this case (along side the unit tests).
And the bug that has been discussed here before (scroll slowly to the end of the current calendar, it snaps back rather than scroll to the next):
Will look into this over the next day or so.
from compactcalendarview.
And the bug that has been discussed here before (scroll slowly to the end of the current calendar, it snaps back rather than scroll to the next):
I added some code to handle this case also now, I've tested on a phone and it seems to be ok. Might need a bit more tweaking though if it doesn't feel right.
from compactcalendarview.
I've tested the scrolling on 2 different devices and it seems good. I couldn't get it to break or do anything odd. Would be good to get a final bit of feedback on this. Alternatively I could release it under a beta release so people can start using it.
from compactcalendarview.
Sorry I've taken so long to reply. I've tested and it seems to be good. But it feels somewhat weird because there is no 'switch transition' when we scroll slowly to the end of the current calendar.
At first look into the code it seems that (int) (Math.abs((int) ( remainingScrollAfterFingerLifted)) / (float) width * ANIMATION_SCREEN_SET_DURATION_MILLIS)
on line 425 returns 0 when we call it in scrollNextMonth
. (I'm not sure, but it seems the most logical)
A beta (or a snapshot using Sonatype's snapshots repository) would be nice.
from compactcalendarview.
Would you mind uploading a gif of what you mean? It should smooth scroll to next month for example if you slowly scroll 75% of the width of the current calendar. Regardless of velocity.
Is the switch transition too sudden?
from compactcalendarview.
This is what I mean (instead of a smooth transition it goes directly to the next month):
from compactcalendarview.
That's weird. That's exactly what I fixed. Maybe I made a mistakes with some commits will check when I get time today.
from compactcalendarview.
I've debugged the sample app on my phone and uploaded the gif. It does give a transition from what I could see. I could increase the animation duration a bit though to make it more noticeable.
I'm not sure why you are not seeing the transition to the prev/next month though.
from compactcalendarview.
Sorry it was my fault. I had this in my onMonthScroll
:
@Override
public void onMonthScroll(Date firstDayOfNewMonth) {
if (mCalendarView != null) {
mCalendarView.setCurrentDate(firstDayOfNewMonth);
}
}
That was causing that there was no transition. It's working fine when I delete that code.
Maybe it should wait for the OverScroller to be finished before calling performMonthScrollCallback()
(don't know how to accomplish this, could not find any callback we can override in OverScroller)
from compactcalendarview.
Ok will look through OverScroller code for this to understand it a little better.
On a side note, you do not need to call mCalendarView.setCurrentDate(firstDayOfNewMonth);
because the calendar will automtically be set to the firstDayOfNewMonth for you.
from compactcalendarview.
dependencies {
compile 'com.github.sundeepk:compact-calendar-view:1.8.2-beta-smooth-scrolling'
}
New beta smooth scrolling version. I plan to make another version available that allows people to make various things a bit more configurable.
from compactcalendarview.
works pretty good.
Great Work.Thanks
from compactcalendarview.
Merged changes to master. Will release soon and update as a comment, closing this issue now.
from compactcalendarview.
dependencies {
compile 'com.github.sundeepk:compact-calendar-view:1.8.3'
}
from compactcalendarview.
Related Issues (20)
- Swipe left and swipe right listener HOT 1
- Background color of abbreviations (weeks)
- Events from REST API
- Work on emulator but not on device
- One event on day : Big circle; multiple event on a day : Big circle + little dot
- Can I use another fonts?
- How to select more days and disable others days tap? How to enable tap only on selected days
- error with add event function
- Color description bar
- error: failed linking references.
- error: resource android:attr/lStar not found.
- using talkback
- Adding Events to CompactCalendar from api call
- Clear Selection
- How to remove the selected current date background when month is scrolled?
- How to present only 1 week ?
- How to pass Calendar as argument?
- Issue
- Events not showing in some android devices api level 33
- Cannot add event line indicator inside selected day circle
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compactcalendarview.