xiaojianglaile / Calendar

Android日历 仿小米 华为 滴答清单 365日历(农历),周视图 月视图 平滑滚动 节假日 五六行周切换 week or month calendar
1.3k stars 254 forks source link

周历跨月份翻页的BUG #7

Open wyq01 opened 7 years ago

wyq01 commented 7 years ago

建议将ScheduleLayout类的第420代码: int row = monthView.getWeekRow() - 1; 改为: int row = CalendarUtils.getWeekRow(monthView.getSelectYear(), monthView.getSelectMonth(), monthView.getSelectDay()); 用以解决在周历跨月份翻页时,月历位置计算不准确导致下拉月历出现位置错位的BUG。

wyq01 commented 7 years ago

在周历的监听器mWeekCalendarClickListener的onClickDate以及onPageChange方法的最后添加 resetCalendarPosition(); 重置月历的位置

xiaojianglaile commented 7 years ago

thanks

LoveqLRC commented 7 years ago

@wyq01

@Override public void onClickDate(int year, int month, int day) { mcvCalendar.setOnCalendarClickListener(null); int months = CalendarUtils.getMonthsAgo(mCurrentSelectYear, mCurrentSelectMonth, year, month); resetCurrentSelectDate(year, month, day); if (months != 0) { int position = mcvCalendar.getCurrentItem() + months; mcvCalendar.setCurrentItem(position, false); } resetMonthView(); mcvCalendar.setOnCalendarClickListener(mMonthCalendarClickListener); resetCalendarPosition(); }

@Override
    public void onPageChange(int year, int month, int day) {
        if (mIsAutoChangeMonthRow) {
            if (mCurrentSelectMonth != month) {
                mCurrentRowsIsSix = CalendarUtils.getMonthRows(year, month) == 6;
            }
        }
        resetCalendarPosition();
    }

是这样吗?

wyq01 commented 7 years ago

是的

wyq01 commented 7 years ago

ScheduleLayout类的第420代码: int row = monthView.getWeekRow() - 1; 改为: int row = CalendarUtils.getWeekRow(monthView.getSelectYear(), monthView.getSelectMonth(), monthView.getSelectDay()); 这段你忘了改

wyq01 commented 7 years ago

现在应该是421行 这行不改 bug修复不了

LoveqLRC commented 7 years ago

@wyq01 你最好说明一下bug如何重现

wyq01 commented 7 years ago

在周历页面进行翻页,翻到跨月份的那周时下拉,拉出月历