public void updateScroll() { if (scrollDate != null && getChildCount() > 1) { CalendarMonthCard card = (CalendarMonthCard) getChildAt(1); CustomDate itemDate = card.getShowDate(); if (itemDate.year * 100 + itemDate.month <= scrollDate.year * 100 + scrollDate.month) { smoothScrollBy(0, 80); } scrollDate = null; } }
public void scrollToToday() { scrollToPosition(positionForToday); if (getChildCount() > 1) { CalendarMonthCard card = (CalendarMonthCard) getChildAt(1); CustomDate itemDate = card.getShowDate(); CustomDate today = new CustomDate(); if (itemDate.year * 100 + itemDate.month <= today.year * 100 + today.month) { smoothScrollBy(0, 80); } } }
public void scrollToDay(CustomDate day) { scrollDate = day; for (int i = 0; i < dataList.size(); i++) { CustomDate item = dataList.get(i); if (item.year == day.year && item.month == day.month) { scrollToPosition(i); break; } } if (getChildCount() > 1) { CalendarMonthCard card = (CalendarMonthCard) getChildAt(1); CustomDate itemDate = card.getShowDate(); if (itemDate.year * 100 + itemDate.month <= day.year * 100 + day.month) { smoothScrollBy(0, 80); } } }