Comments (13)
@aKuriel make sure to check if the events are already rendered. As per my checking onmontchangelistener is being called three times.
from android-week-view.
@aKuriel This seems to be an error on your side. Does it also happen when you run the demo app ?
from android-week-view.
it's always being called 3 times, for the period before the current period, for the current period and for the periode after the current period.
from android-week-view.
@khent04 Check the documentation at https://github.com/alamkanak/Android-Week-View/blob/ed450d8c68a82fa176d37140880a6c921c98c521/library/src/main/java/com/alamkanak/weekview/MonthLoader.java#L41
from android-week-view.
Hi @caske33 , yeaps.. Thanks to that but i already checked that couple of weeks ago. I am just responding to issue.
Maybe we should address that to him
from android-week-view.
Oops, indeed, sorry!
@aKuriel: check my previous comment
from android-week-view.
i have this code:
final List<WeekViewEvent> events = new ArrayList<>();
Calendar calendarStart = Calendar.getInstance(Locale.US);
Calendar calendar = Calendar.getInstance(Locale.US);
calendarStart.add(Calendar.HOUR_OF_DAY, -5);
events.add(new WeekViewEvent(1, "Evento 1", calendarStart, calendar));
// wvEventos is the WeekView
wvEventos.setMonthChangeListener(new MonthLoader.MonthChangeListener() {
@Override
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
return events;
}
});
As you can see events list is initialized out of onMonthChange interface, but still adding events 3 times to view.
from android-week-view.
@aKuriel See the link caske posted above: https://github.com/alamkanak/Android-Week-View/blob/ed450d8c68a82fa176d37140880a6c921c98c521/library/src/main/java/com/alamkanak/weekview/MonthLoader.java#L41
You should only return the events that are part of the period, but you always return the same list and because the MonthChangeListener.onMonthChange() is always called 3 times (as documented in the link above), your events are added 3 times.
from android-week-view.
should to be a filter in the api side, something like:
if(events are not for this month){
// dont add to calendar.
}
or
if(id of event already exists){
// override event or skip adding event
}
a common use case it's to load first the whole events list, for example a query:
SELECT * FROM EVENTS WHERE BETWEEN start AND end;
with the current api we have to handle every interface method call:
if(myListItems are from this month){
add event to list return;
}
to much work for something that should to be skipped.
or maybe i have not understanding the right implementation of this method, could you sir, please, explain me? i'm new with this api and excuse me if i don't understand so fast.
from android-week-view.
@aKuriel The query you should use would be SELECT * FROM EVENT WHERE BETWEEN startOfTheMonth AND endOfTheMonth
. This would solve your problem. This is not something the library should do, the library asks which events to draw for a certain month, then you have to return only the events of that month.
from android-week-view.
sure, we can do it in the api user side, i just giving my opinion, we can skip this validation part of previous current and next month, for a more comfortable use of api, you guys are doing a very good work, we are gonna be happy if your team can consider my suggest.
Regards.
from android-week-view.
@aKuriel This monthLoader is used for efficiency, events are only loaded when the user is actually looking at a date near the date of the event.
So i'm afraid we won't implement your suggestion.
from android-week-view.
just another opinion: this init way is ugly. thanks.
from android-week-view.
Related Issues (20)
- Bug with goToHour method when time range is set HOT 3
- Serious bug in viewing events : not showing all events that are given HOT 1
- Bug: adding full day WeekViewEvent with same startDate and endDate results in single cell HOT 1
- Event not drawing on 31st day of month HOT 2
- Events Not loading after asynchronous call
- On Load scroll to current time, not 12am HOT 1
- disable fling doesn't seem to work correctly HOT 1
- Crash issue
- Enchanced : customize the date format
- Preview Render Problems HOT 1
- Add Event Dynamically HOT 3
- Crashes on API 28
- doesnt shows anything any help HOT 1
- Needs to Click the gototoday before showing all the events
- How to implement a multi-line String on header date
- Drag and Drop feature on marked Events HOT 3
- 动态添加event 一直返回
- Event title vertical alignment
- Multiple events on same day not showing
- is it possible to turn off zoom?
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 android-week-view.