Scusa, non ho scritto la prima parte del metodo per non farvi confondere....cmq lo scrivo tutto e ti invito a leggere il primo post per capire il problema:
codice:private void getMoreEvents(Calendar day) { // Get more events if the month is changed. if (mEventRects == null) mEventRects = new ArrayList<EventRect>(); if (mMonthChangeListener == null && !isInEditMode()) throw new IllegalStateException("You must provide a MonthChangeListener"); // If a refresh was requested then reset some variables. if (mRefreshEvents) { mEventRects.clear(); mFetchedMonths = new int[3]; } // Get events of previous month. int previousMonth = (day.get(Calendar.MONTH) == 0 ? 12 : day.get(Calendar.MONTH)); int nextMonth = (day.get(Calendar.MONTH) + 2 == 13 ? 1 : day.get(Calendar.MONTH) + 2); int[] lastFetchedMonth = mFetchedMonths.clone(); if (mFetchedMonths[0] < 1 || mFetchedMonths[0] != previousMonth || mRefreshEvents) { if (!containsValue(lastFetchedMonth, previousMonth) && !isInEditMode()) { List<WeekViewEvent> events = mMonthChangeListener.onMonthChange((previousMonth == 12) ? day.get(Calendar.YEAR) - 1 : day.get(Calendar.YEAR), previousMonth); sortEvents(events); for (WeekViewEvent event : events) { cacheEvent(event); } } mFetchedMonths[0] = previousMonth; } // Get events of this month. if (mFetchedMonths[1] < 1 || mFetchedMonths[1] != day.get(Calendar.MONTH) + 1 || mRefreshEvents) { if (!containsValue(lastFetchedMonth, day.get(Calendar.MONTH) + 1) && !isInEditMode()) { List<WeekViewEvent> events = mMonthChangeListener.onMonthChange(day.get(Calendar.YEAR), day.get(Calendar.MONTH) + 1); sortEvents(events); for (WeekViewEvent event : events) { cacheEvent(event); } } mFetchedMonths[1] = day.get(Calendar.MONTH) + 1; } // Get events of next month. if (mFetchedMonths[2] < 1 || mFetchedMonths[2] != nextMonth || mRefreshEvents) { if (!containsValue(lastFetchedMonth, nextMonth) && !isInEditMode()) { List<WeekViewEvent> events = mMonthChangeListener.onMonthChange(nextMonth == 1 ? day.get(Calendar.YEAR) + 1 : day.get(Calendar.YEAR), nextMonth); sortEvents(events); for (WeekViewEvent event : events) { cacheEvent(event); } } mFetchedMonths[2] = nextMonth; } // Prepare to calculate positions of each events. ArrayList<EventRect> tempEvents = new ArrayList<EventRect>(mEventRects); mEventRects = new ArrayList<EventRect>(); for (int j = 1; j <= id_nome_op.length;) { ArrayList<EventRect> eventRects = new ArrayList<EventRect>(); for (EventRect eventRect : tempEvents) { if(eventRect.event.getIdOperatore() == j) eventRects.add(eventRect); Log.d("compare", "compare " + j + " idOperatore " + eventRect.event.getIdOperatore()); } computePositionOfEvents(eventRects); j++; } }

Rispondi quotando