Constructors Summary |
---|
public CalendarViewMaterialDelegate(CalendarView delegator, android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(delegator, context);
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.CalendarView, defStyleAttr, defStyleRes);
final int firstDayOfWeek = a.getInt(R.styleable.CalendarView_firstDayOfWeek,
LocaleData.get(Locale.getDefault()).firstDayOfWeek);
final long minDate = parseDateToMillis(a.getString(
R.styleable.CalendarView_minDate), DEFAULT_MIN_DATE);
final long maxDate = parseDateToMillis(a.getString(
R.styleable.CalendarView_maxDate), DEFAULT_MAX_DATE);
if (maxDate < minDate) {
throw new IllegalArgumentException("max date cannot be before min date");
}
final long setDate = MathUtils.constrain(System.currentTimeMillis(), minDate, maxDate);
final int dateTextAppearanceResId = a.getResourceId(
R.styleable.CalendarView_dateTextAppearance,
R.style.TextAppearance_DeviceDefault_Small);
a.recycle();
mDayPickerView = new DayPickerView(context);
mDayPickerView.setFirstDayOfWeek(firstDayOfWeek);
mDayPickerView.setCalendarTextAppearance(dateTextAppearanceResId);
mDayPickerView.setMinDate(minDate);
mDayPickerView.setMaxDate(maxDate);
mDayPickerView.setDate(setDate, false, true);
mDayPickerView.setOnDaySelectedListener(mOnDaySelectedListener);
delegator.addView(mDayPickerView);
|
Methods Summary |
---|
public long | getDate()
return mDayPickerView.getDate();
|
public int | getDateTextAppearance()
return 0;
|
public int | getFirstDayOfWeek()
return mDayPickerView.getFirstDayOfWeek();
|
public int | getFocusedMonthDateColor()
return 0;
|
public long | getMaxDate()
return mDayPickerView.getMaxDate();
|
public long | getMinDate()
return mDayPickerView.getMinDate();
|
public android.graphics.drawable.Drawable | getSelectedDateVerticalBar()
// Deprecated.
return null;
|
public int | getSelectedWeekBackgroundColor()
return 0;
|
public boolean | getShowWeekNumber()
// Deprecated.
return false;
|
public int | getShownWeekCount()
// Deprecated.
return 0;
|
public int | getUnfocusedMonthDateColor()
return 0;
|
public int | getWeekDayTextAppearance()
return 0;
|
public int | getWeekNumberColor()
// Deprecated.
return 0;
|
public int | getWeekSeparatorLineColor()
// Deprecated.
return 0;
|
public void | onConfigurationChanged(android.content.res.Configuration newConfig)
// Nothing to do here, configuration changes are already propagated
// by ViewGroup.
|
private long | parseDateToMillis(java.lang.String dateStr, java.lang.String defaultDateStr)
final Calendar tempCalendar = Calendar.getInstance();
if (TextUtils.isEmpty(dateStr) || !parseDate(dateStr, tempCalendar)) {
parseDate(defaultDateStr, tempCalendar);
}
return tempCalendar.getTimeInMillis();
|
public void | setDate(long date)
mDayPickerView.setDate(date, true, false);
|
public void | setDate(long date, boolean animate, boolean center)
mDayPickerView.setDate(date, animate, center);
|
public void | setDateTextAppearance(int resourceId)
|
public void | setFirstDayOfWeek(int firstDayOfWeek)
mDayPickerView.setFirstDayOfWeek(firstDayOfWeek);
|
public void | setFocusedMonthDateColor(int color)
// TODO: Should use a ColorStateList. Deprecate?
|
public void | setMaxDate(long maxDate)
mDayPickerView.setMaxDate(maxDate);
|
public void | setMinDate(long minDate)
mDayPickerView.setMinDate(minDate);
|
public void | setOnDateChangeListener(CalendarView.OnDateChangeListener listener)
mOnDateChangeListener = listener;
|
public void | setSelectedDateVerticalBar(int resourceId)
// Deprecated.
|
public void | setSelectedDateVerticalBar(android.graphics.drawable.Drawable drawable)
// Deprecated.
|
public void | setSelectedWeekBackgroundColor(int color)
// TODO: Should use a ColorStateList. Deprecate?
|
public void | setShowWeekNumber(boolean showWeekNumber)
// Deprecated.
|
public void | setShownWeekCount(int count)
// Deprecated.
|
public void | setUnfocusedMonthDateColor(int color)
// TODO: Should use a ColorStateList. Deprecate?
|
public void | setWeekDayTextAppearance(int resourceId)
|
public void | setWeekNumberColor(int color)
// Deprecated.
|
public void | setWeekSeparatorLineColor(int color)
// Deprecated.
|