import java.util.Calendar;

public class MyClass {
    /**
     *  the first day of the week. First day of the week is used only when the week view is first
     * drawn. It does not of any effect after user starts scrolling horizontally.
     *
     * **Note:** This method will only work if the week view is set to display more than 6 days at
     * once.
     *
     * supported values are [java.util.Calendar.SUNDAY],
     * [java.util.Calendar.MONDAY], [java.util.Calendar.TUESDAY],
     * [java.util.Calendar.WEDNESDAY], [java.util.Calendar.THURSDAY],
     * [java.util.Calendar.FRIDAY].
     */
    private int firstDayOfWeek = Calendar.getInstance().getFirstDayOfWeek();

    public int getFirstDayOfWeek() {
        return firstDayOfWeek;
    }

    public void setFirstDayOfWeek(int value) {
        if (firstDayOfWeek == value)
            return;
        firstDayOfWeek = value;
        invalidate();
    }

    private float textSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12.0f, context.getResources().getDisplayMetrics());

    public float getTextSize() {
        return textSize;
    }

    public void setTextSize(float value) {
        if (textSize == value)
            return;
        textSize = value;
        timeTextPaint.setTextSize(value);
        allDaySideTitleTextPaint.setTextSize(value);
        invalidate();
    }

    private float headerWeekDayTitleTextSize = textSize;

    public float getHeaderWeekDayTitleTextSize() {
        return headerWeekDayTitleTextSize;
    }

    public void setHeaderWeekDayTitleTextSize(float value) {
        if (headerWeekDayTitleTextSize == value)
            return;
        headerWeekDayTitleTextSize = value;
        mHeaderWeekDayTitleTextPaint.setTextSize(value);
        mHeaderWeekDayTitleTodayTextPaint.setTextSize(value);
        sideTitleTextPaint.setTextSize(value);
        invalidate();
    }

    private float headerWeekDaySubtitleTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 22.0f, context.getResources().getDisplayMetrics());

    public float getHeaderWeekDaySubtitleTextSize() {
        return headerWeekDaySubtitleTextSize;
    }

    public void setHeaderWeekDaySubtitleTextSize(float value) {
        if (headerWeekDaySubtitleTextSize == value)
            return;
        headerWeekDaySubtitleTextSize = value;
        mHeaderWeekDaySubtitleTextPaint.setTextSize(value);
        mHeaderWeekDaySubtitleTodayTextPaint.setTextSize(value);
        sideSubtitleTextPaint.setTextSize(value);
        invalidate();
    }

    private float headerColumnPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10f, resources.getDisplayMetrics());

    public float getHeaderColumnPadding() {
        return headerColumnPadding;
    }

    public void setHeaderColumnPadding(float value) {
        if (headerColumnPadding == value)
            return;
        headerColumnPadding = value;
        mHeaderColumnWidth = timeTextWidth + headerColumnPadding * 2.0f;
        invalidate();
    }

    private int headerColumnTextColor = Color.BLACK;

    public int getHeaderColumnTextColor() {
        return headerColumnTextColor;
    }

    public void setHeaderColumnTextColor(int value) {
        if (headerColumnTextColor == value)
            return;
        headerColumnTextColor = value;
        mHeaderWeekDayTitleTextPaint.setColor(value);
        mHeaderWeekDaySubtitleTextPaint.setColor(value);
        timeTextPaint.setColor(value);
        sideTitleTextPaint.setColor(value);
        sideSubtitleTextPaint.setColor(value);
        allDaySideTitleTextPaint.setColor(value);
        invalidate();
    }

    private int allDaySideTitleTextColor = headerColumnTextColor;

    public int getAllDaySideTitleTextColor() {
        return allDaySideTitleTextColor;
    }

    public void setAllDaySideTitleTextColor(int value) {
        if (allDaySideTitleTextColor == value)
            return;
        allDaySideTitleTextColor = value;
        allDaySideTitleTextPaint.setColor(value);
        invalidate();
    }

    private int headerRowBackgroundColor = Color.WHITE;

    public int getHeaderRowBackgroundColor() {
        return headerRowBackgroundColor;
    }

    public void setHeaderRowBackgroundColor(int value) {
        if (headerRowBackgroundColor == value)
            return;
        headerRowBackgroundColor = value;
        mHeaderBackgroundPaint.setColor(value);
        invalidate();
    }

    private int dayBackgroundColor = Color.rgb(245, 245, 245);

    public int getDayBackgroundColor() {
        return dayBackgroundColor;
    }

    public void setDayBackgroundColor(int value) {
        if (dayBackgroundColor == value)
            return;
        dayBackgroundColor = value;
        mDayBackgroundPaint.setColor(value);
        invalidate();
    }

    private int hourSeparatorColor = Color.rgb(230, 230, 230);

    public int getHourSeparatorColor() {
        return hourSeparatorColor;
    }

    public void setHourSeparatorColor(int value) {
        if (hourSeparatorColor == value)
            return;
        hourSeparatorColor = value;
        mHourSeparatorPaint.setColor(value);
        invalidate();
    }

    private int todayColumnBackgroundColor = Color.rgb(239, 247, 254);

    public int getTodayColumnBackgroundColor() {
        return todayColumnBackgroundColor;
    }

    public void setTodayColumnBackgroundColor(int value) {
        if (todayColumnBackgroundColor == value)
            return;
        todayColumnBackgroundColor = value;
        mTodayColumnBackgroundPaint.setColor(value);
        invalidate();
    }

    private int hourSeparatorHeight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, resources.getDisplayMetrics()).toInt();

    public int getHourSeparatorHeight() {
        return hourSeparatorHeight;
    }

    public void setHourSeparatorHeight(int value) {
        if (hourSeparatorHeight == value)
            return;
        hourSeparatorHeight = value;
        mHourSeparatorPaint.setStrokeWidth(value.toFloat());
        invalidate();
    }

    private int todayHeaderTextColor = Color.rgb(39, 137, 228);

    public int getTodayHeaderTextColor() {
        return todayHeaderTextColor;
    }

    public void setTodayHeaderTextColor(int value) {
        if (todayHeaderTextColor == value)
            return;
        todayHeaderTextColor = value;
        mHeaderWeekDayTitleTodayTextPaint.setColor(value);
        mHeaderWeekDaySubtitleTodayTextPaint.setColor(value);
        invalidate();
    }

    private float eventTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12.0f, context.getResources().getDisplayMetrics());

    public float getEventTextSize() {
        return eventTextSize;
    }

    public void setEventTextSize(float value) {
        if (eventTextSize == value)
            return;
        eventTextSize = value;
        mEventTextPaint.setTextSize(value);
        invalidate();
    }
}
convert fifth part of kotlin class to java code below from previous code the first day of the week First day of the week is used only when the week view is first drawn It does not of an

原文地址: https://www.cveoy.top/t/topic/jd0h 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录