private int numberOfPeriods() {
    return (int) ((mMaxTime - mMinTime) * (60.0 / timeColumnResolution));
}

private float yMinLimit() {
    return -(((hourHeight * (mMaxTime - mMinTime))
            + headerHeight
            + weekDaysHeaderRowTotalPadding
            + spaceBelowAllDayEvents
            + timeTextHeight / 2) - height);
}

private float yMaxLimit() {
    return 0f;
}

private float xMinLimit() {
    if (maxDate == null) {
        return Integer.MIN_VALUE;
    } else {
        Calendar date = (Calendar) maxDate.clone();
        date.add(Calendar.DATE, 1 - realNumberOfVisibleDays());
        while (date.before(minDate)) {
            date.add(Calendar.DATE, 1);
        }

        return getXOriginForDate(date);
    }
}

private float xMaxLimit() {
    if (minDate == null) {
        return Integer.MAX_VALUE;
    } else {
        return getXOriginForDate(minDate);
    }
}

private int minHourOffset() {
    return hourHeight * mMinTime;
}

private float eventsTop() {
    return mCurrentOrigin.y + headerHeight + weekDaysHeaderRowTotalPadding + timeTextHeight / 2 - minHourOffset();
}

private int leftDaysWithGaps() {
    return (int) Math.ceil((mCurrentOrigin.x / (widthPerDay + columnGap)));
}

private float xStartPixel() {
    return mCurrentOrigin.x + (widthPerDay + columnGap) * leftDaysWithGaps() +
            mHeaderColumnWidth;
}

private MonthChangeListener monthChangeListener = null;

/**
 *  the interpreter which provides the text to show in the header column and the header row.
 */
private DateTimeInterpreter dateTimeInterpreter = new DateTimeInterpreter() {
    Calendar calendar = Calendar.getInstance();
    DateFormat timeFormat = DateFormat.getTimeFormat(context) != null ? DateFormat.getTimeFormat(context) : new SimpleDateFormat('HH:mm', Locale.getDefault());
    DateFormat shortDateFormat = WeekViewUtil.getWeekdayWithNumericDayAndMonthFormat(context, true);
    DateFormat normalDateFormat = WeekViewUtil.getWeekdayWithNumericDayAndMonthFormat(context, false);

    {
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
    }

    @Override
    public String getFormattedTimeOfDay(int hour, int minutes) {
        calendar.set(Calendar.HOUR_OF_DAY, hour);
        calendar.set(Calendar.MINUTE, minutes);
        return timeFormat.format(calendar.getTime());
    }

    @Override
    public String getFormattedWeekDayTitle(Calendar date) {
        boolean shortDate = dayNameLength == LENGTH_SHORT;
        return shortDate ? shortDateFormat.format(date.getTime()) : normalDateFormat.format(date.getTime());
    }
};

private WeekDaySubtitleInterpreter weekDaySubtitleInterpreter = null;

/**
 *  the real number of visible days
 * If the amount of days between max date and min date is smaller, that value is returned
 */
private int realNumberOfVisibleDays() {
    if (minDate == null || maxDate == null) {
        return numberOfVisibleDays;
    } else {
        return Math.min(numberOfVisibleDays, daysBetween(minDate, maxDate) + 1);
    }
}

/**
 *  the number of visible days in a week.
 */
private int numberOfVisibleDays = 3;

private int hourHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50f, getResources().getDisplayMetrics());

private int columnGap = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, getResources().getDisplayMetrics());
Convert Kotlin Class to Java Code: WeekView Properties

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

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