convert seventh part of kotlin class to java code below from previous code focus point 0 = top of view 1 = bottom of view The focused point multiplier of the view height where the week
private float zoomFocusPoint = 0f;
public float getZoomFocusPoint() {
return zoomFocusPoint;
}
public void setZoomFocusPoint(float value) {
if (value < 0 || value > 1) {
throw new IllegalStateException("The zoom focus point percentage has to be between 0 and 1");
}
zoomFocusPoint = value;
}
private int pastBackgroundColor = Color.rgb(227, 227, 227);
public int getPastBackgroundColor() {
return pastBackgroundColor;
}
public void setPastBackgroundColor(int value) {
pastBackgroundColor = value;
mPastBackgroundPaint.setColor(value);
}
private int futureBackgroundColor = Color.rgb(245, 245, 245);
public int getFutureBackgroundColor() {
return futureBackgroundColor;
}
public void setFutureBackgroundColor(int value) {
futureBackgroundColor = value;
mFutureBackgroundPaint.setColor(value);
}
private int pastWeekendBackgroundColor = 0;
public int getPastWeekendBackgroundColor() {
return pastWeekendBackgroundColor;
}
public void setPastWeekendBackgroundColor(int value) {
pastWeekendBackgroundColor = value;
mPastWeekendBackgroundPaint.setColor(value);
}
private int futureWeekendBackgroundColor = 0;
public int getFutureWeekendBackgroundColor() {
return futureWeekendBackgroundColor;
}
public void setFutureWeekendBackgroundColor(int value) {
futureWeekendBackgroundColor = value;
mFutureWeekendBackgroundPaint.setColor(value);
}
private boolean isScrollNumberOfVisibleDays = false;
public boolean isScrollNumberOfVisibleDays() {
return isScrollNumberOfVisibleDays;
}
public void setScrollNumberOfVisibleDays(boolean value) {
if (isScrollNumberOfVisibleDays == value) {
return;
}
isScrollNumberOfVisibleDays = value;
invalidate();
}
public double getFirstVisibleHour() {
return (-mCurrentOrigin.y / hourHeight);
}
private boolean isUsingCheckersStyle = false;
public boolean isUsingCheckersStyle() {
return isUsingCheckersStyle;
}
public void setUsingCheckersStyle(boolean value) {
if (isUsingCheckersStyle == value) {
return;
}
isUsingCheckersStyle = value;
invalidate();
}
private boolean isSubtitleHeaderEnabled() {
return weekDaySubtitleInterpreter != null;
}
// other fields and properties
private enum Direction {
NONE, LEFT, RIGHT, VERTICAL
}
private TimeChangedBroadcastReceiver timeChangedBroadcastReceiver;
private Calendar today = WeekViewUtil.today();
private Map<Pair<SimpleDate, Integer>, Boolean> containsAllDayEventCache = new HashMap<>();
private Map<SimpleDate, String> weekDayTitleFormatterCache = new HashMap<>();
private Map<SimpleDate, String> weekDaySubtitleFormatterCache = new HashMap<>();
private Map<Pair<Integer, Integer>, String> timeFormatterCache = new HashMap<>();
public WeekView() {
timeChangedBroadcastReceiver = new TimeChangedBroadcastReceiver() {
@Override
public void onTimeChanged() {
WeekView.this.today = WeekViewUtil.today();
invalidate();
}
};
timeChangedBroadcastReceiver.register(context, Calendar.getInstance());
textColorPicker = new TextColorPicker() {
@Override
public int getTextColor(WeekViewEvent event) {
int color = event.getColor();
double a = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255;
return a < 0.2 ? Color.BLACK : Color.WHITE;
}
};
// Get the attribute values (if any).
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.WeekView, 0, 0);
try {
firstDayOfWeek = a.getInteger(R.styleable.WeekView_firstDayOfWeek, firstDayOfWeek);
hourHeight = a.getDimensionPixelSize(R.styleable.WeekView_hourHeight, hourHeight);
minHourHeight = a.getDimensionPixelSize(R.styleable.WeekView_minHourHeight, minHourHeight);
mEffectiveMinHourHeight = minHourHeight;
maxHourHeight = a.getDimensionPixelSize(R.styleable.WeekView_maxHourHeight, maxHourHeight);
textSize = a.getDimension(R.styleable.WeekView_textSize, textSize);
headerColumnPadding = a.getDimension(R.styleable.WeekView_headerColumnPadding, headerColumnPadding);
columnGap = a.getDimensionPixelSize(R.styleable.WeekView_columnGap, columnGap);
headerColumnTextColor = a.getColor(R.styleable.WeekView_headerColumnTextColor, headerColumnTextColor);
numberOfVisibleDays = a.getInteger(R.styleable.WeekView_noOfVisibleDays, numberOfVisibleDays);
isShowFirstDayOfWeekFirst = a.getBoolean(R.styleable.WeekView_showFirstDayOfWeekFirst, isShowFirstDayOfWeekFirst);
weekDayHeaderRowPaddingTop = a.getDimension(R.styleable.WeekView_weekDayHeaderRowPaddingTop, weekDayHeaderRowPaddingTop);
weekDayHeaderRowPaddingBottom = a.getDimension(R.styleable.WeekView_weekDayHeaderRowPaddingBottom, weekDayHeaderRowPaddingBottom);
headerRowBackgroundColor = a.getColor(R.styleable.WeekView_headerRowBackgroundColor, headerRowBackgroundColor);
dayBackgroundColor = a.getColor(R.styleable.WeekView_dayBackgroundColor, dayBackgroundColor);
futureBackgroundColor = a.getColor(R.styleable.WeekView_futureBackgroundColor, futureBackgroundColor);
pastBackgroundColor = a.getColor(R.styleable.WeekView_pastBackgroundColor, pastBackgroundColor);
futureWeekendBackgroundColor = a.getColor(R.styleable.WeekView_futureWeekendBackgroundColor, futureBackgroundColor);
pastWeekendBackgroundColor = a.getColor(R.styleable.WeekView_pastWeekendBackgroundColor, pastBackgroundColor);
nowLineColor = a.getColor(R.styleable.WeekView_nowLineColor, nowLineColor);
nowLineThickness = a.getDimensionPixelSize(R.styleable.WeekView_nowLineThickness, nowLineThickness);
hourSeparatorColor = a.getColor(R.styleable.WeekView_hourSeparatorColor, hourSeparatorColor);
todayColumnBackgroundColor = a.getColor(R.styleable.WeekView_todayColumnBackgroundColor, todayColumnBackgroundColor);
hourSeparatorHeight = a.getDimensionPixelSize(R.styleable.WeekView_hourSeparatorHeight, hourSeparatorHeight);
todayHeaderTextColor = a.getColor(R.styleable.WeekView_todayHeaderTextColor, todayHeaderTextColor);
eventTextSize = a.getDimension(R.styleable.WeekView_eventTextSize, eventTextSize);
eventTextColor = a.getColor(R.styleable.WeekView_eventTextColor, eventTextColor);
newEventColor = a.getColor(R.styleable.WeekView_newEventColor, newEventColor);
newEventIconDrawable = a.getDrawable(R.styleable.WeekView_newEventIconResource);
newEventIdentifier = a.getString(R.styleable.WeekView_newEventIdentifier);
newEventLengthInMinutes = a.getInt(R.styleable.WeekView_newEventLengthInMinutes, newEventLengthInMinutes);
newEventTimeResolutionInMinutes = a.getInt(R.styleable.WeekView_newEventTimeResolutionInMinutes, newEventTimeResolutionInMinutes);
eventPadding = a.getDimensionPixelSize(R.styleable.WeekView_eventPadding, eventPadding);
dayNameLength = a.getInteger(R.styleable.WeekView_dayNameLength, dayNameLength);
overlappingEventGap = a.getDimension(R.styleable.WeekView_overlappingEventGap, overlappingEventGap);
spaceBetweenWeekDaysAndAllDayEvents = a.getDimensionPixelSize(R.styleable.WeekView_spaceBetweenWeekDaysAndAllDayEvents, spaceBetweenWeekDaysAndAllDayEvents);
xScrollingSpeed = a.getFloat(R.styleable.WeekView_xScrollingSpeed, xScrollingSpeed);
eventCornerRadius = a.getDimension(R.styleable.WeekView_eventCornerRadius, eventCornerRadius);
isShowDistinctPastFutureColor = a.getBoolean(R.styleable.WeekView_showDistinctPastFutureColor, isShowDistinctPastFutureColor);
isShowDistinctWeekendColor = a.getBoolean(R.styleable.WeekView_showDistinctWeekendColor, isShowDistinctWeekendColor);
isShowNowLine = a.getBoolean(R.styleable.WeekView_showNowLine, isShowNowLine);
isHorizontalFlingEnabled = a.getBoolean(R.styleable.WeekView_horizontalFlingEnabled, isHorizontalFlingEnabled);
isVerticalFlingEnabled = a.getBoolean(R.styleable.WeekView_verticalFlingEnabled, isVerticalFlingEnabled);
allDayEvent
原文地址: https://www.cveoy.top/t/topic/jd0F 著作权归作者所有。请勿转载和采集!