Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置了lastNextMothAlphaColor属性为@android:color/transparent,但是还是会显示上一个月的临近该月的数据。如何能够做到只展示当月数据。 #94

Open
shanallen opened this issue Mar 7, 2024 · 1 comment

Comments

@shanallen
Copy link

No description provided.

@shanallen
Copy link
Author

InnerPainter--->onDrawDisableDate(Canvas canvas, RectF rectF, LocalDate localDate)--->
if(isBelongCurrentMonth(localDate)){
drawSolar(canvas, rectF, localDate, mAttrs.defaultUnCheckedSolarTextColor, mAttrs.disabledAlphaColor);
drawLunar(canvas, rectF, localDate, mAttrs.defaultUnCheckedLunarTextColor, mAttrs.disabledAlphaColor);
drawPoint(canvas, rectF, localDate, mDefaultUnCheckedPoint, mAttrs.disabledAlphaColor);
drawHolidayWorkday(canvas, rectF, localDate, mAttrs.defaultUnCheckedHoliday, mAttrs.defaultUnCheckedWorkday, mAttrs.defaultUnCheckedHolidayTextColor, mAttrs.defaultUnCheckedWorkdayTextColor, mAttrs.disabledAlphaColor);
drawStretchText(canvas, rectF, mAttrs.disabledAlphaColor, localDate);
}

public boolean isBelongCurrentMonth(LocalDate dateToCheck){
// 获取当前日期的年份和月份
LocalDate currentDate = LocalDate.now();
int currentYear = currentDate.getYear();
int currentMonth = currentDate.getMonthOfYear();

    int yearToCheck = dateToCheck.getYear();
    int monthToCheck = dateToCheck.getMonthOfYear();

    // 判断是否在当前月
    if (currentYear == yearToCheck && currentMonth == monthToCheck) {
        return true;
    } else {
        return false;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant