Comments (11)
There is a much easier fix..
Switch OnSingleTapConfirmed for onSingleTapUp..
OnSingleTapConfirmed waits to make sure you are not double clicking.
from compactcalendarview.
I'll have to run the example that's shipped with the code to test things out when I get the time, but what version are you running? Are you on the latest?
from compactcalendarview.
Yep, latest!
from compactcalendarview.
Ok thanks. There is a slight bit of lag clicking days, it's something that I wanted to looks at for a while. There's some calculations that are running to find the correct day that was click. The only things I can do is run some android code profiling commands to figure out where most of the cpu time is spent. I have a suspicion though that the calendar is being redrawn an extra time than needed. So instead of drawing once, it draws twice.
from compactcalendarview.
So after a little investigation and profiling, the code doesn't look like it's actually slow or drawing unnecessarily. However, I am using GestureDetector.SimpleOnGestureListener to listen for onSingleTapConfirmed event. Looking through android source code, basically, GestureDetectorCompat android will wait for some time until an event is considered a single tap event. This time is what you see as the lag (at least I think so).
As an experiment, you can move the code from onSingleTapConfirmed method to on down in the CompactCalendar class. You will see that the UI updates immediately. However, this causes other issues with scrolling and oddities with gesture detection.
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
// Date onDateClicked = compactCalendarController.onSingleTapConfirmed(e);
// invalidate();
// if(listener != null){
// listener.onDayClick(onDateClicked);
// }
return super.onSingleTapConfirmed(e);
}
@Override
public boolean onDown(MotionEvent e) {
Date onDateClicked = compactCalendarController.onSingleTapConfirmed(e);
invalidate();
if(listener != null){
listener.onDayClick(onDateClicked);
}
return compactCalendarController.onDown(e);
}
So the fix? Well I can see implementing custom gesture detection as one way of doing things without much thought. But I'll have to think about this a little bit :)
from compactcalendarview.
Thanks for the comment, I'll investigate this soon then.
from compactcalendarview.
@spartacusrex99 fix is great, but why isn't it integrated? your comment is from april.
from compactcalendarview.
@yoavst Mostly because I have been implementing other feature and enhacements. There is some pull request I want to merge before. Once that feature is merged I will have a look at this.
from compactcalendarview.
Thanks! Currently I'm not using this library, but I'll be happy to use this library for performance reason.
from compactcalendarview.
So good news, this has been fixed and will be merged some time this week. Will update once a new version is out.
from compactcalendarview.
Merged will release a new version some time in the next few days.
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.