Constructors Summary |
---|
public DatePicker(android.content.Context context)
this(context, null);
|
public DatePicker(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, R.attr.datePickerStyle);
|
public DatePicker(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
|
public DatePicker(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DatePicker,
defStyleAttr, defStyleRes);
final int mode = a.getInt(R.styleable.DatePicker_datePickerMode, MODE_SPINNER);
final int firstDayOfWeek = a.getInt(R.styleable.DatePicker_firstDayOfWeek, 0);
a.recycle();
switch (mode) {
case MODE_CALENDAR:
mDelegate = createCalendarUIDelegate(context, attrs, defStyleAttr, defStyleRes);
break;
case MODE_SPINNER:
default:
mDelegate = createSpinnerUIDelegate(context, attrs, defStyleAttr, defStyleRes);
break;
}
if (firstDayOfWeek != 0) {
setFirstDayOfWeek(firstDayOfWeek);
}
|
Methods Summary |
---|
private android.widget.DatePicker$DatePickerDelegate | createCalendarUIDelegate(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
return new DatePickerCalendarDelegate(this, context, attrs, defStyleAttr,
defStyleRes);
|
private android.widget.DatePicker$DatePickerDelegate | createSpinnerUIDelegate(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
return new DatePickerSpinnerDelegate(this, context, attrs, defStyleAttr, defStyleRes);
|
public boolean | dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
return mDelegate.dispatchPopulateAccessibilityEvent(event);
|
protected void | dispatchRestoreInstanceState(android.util.SparseArray container)
dispatchThawSelfOnly(container);
|
public CalendarView | getCalendarView()Gets the {@link CalendarView}.
This method returns {@code null} when the
{@link android.R.styleable#DatePicker_datePickerMode} attribute is set
to {@code calendar}.
return mDelegate.getCalendarView();
|
public boolean | getCalendarViewShown()Gets whether the {@link CalendarView} is shown.
return mDelegate.getCalendarViewShown();
|
public int | getDayOfMonth()
return mDelegate.getDayOfMonth();
|
public int | getFirstDayOfWeek()Gets the first day of week.
return mDelegate.getFirstDayOfWeek();
|
public long | getMaxDate()Gets the maximal date supported by this {@link DatePicker} in
milliseconds since January 1, 1970 00:00:00 in
{@link TimeZone#getDefault()} time zone.
Note: The default maximal date is 12/31/2100.
return mDelegate.getMaxDate().getTimeInMillis();
|
public long | getMinDate()Gets the minimal date supported by this {@link DatePicker} in
milliseconds since January 1, 1970 00:00:00 in
{@link TimeZone#getDefault()} time zone.
Note: The default minimal date is 01/01/1900.
return mDelegate.getMinDate().getTimeInMillis();
|
public int | getMonth()
return mDelegate.getMonth();
|
public boolean | getSpinnersShown()Gets whether the spinners are shown.
return mDelegate.getSpinnersShown();
|
public int | getYear()
return mDelegate.getYear();
|
public void | init(int year, int monthOfYear, int dayOfMonth, android.widget.DatePicker$OnDateChangedListener onDateChangedListener)Initialize the state. If the provided values designate an inconsistent
date the values are normalized before updating the spinners.
mDelegate.init(year, monthOfYear, dayOfMonth, onDateChangedListener);
|
public boolean | isEnabled()
return mDelegate.isEnabled();
|
protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
mDelegate.onConfigurationChanged(newConfig);
|
public void | onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onInitializeAccessibilityEvent(event);
mDelegate.onInitializeAccessibilityEvent(event);
|
public void | onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
super.onInitializeAccessibilityNodeInfo(info);
mDelegate.onInitializeAccessibilityNodeInfo(info);
|
public void | onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onPopulateAccessibilityEvent(event);
mDelegate.onPopulateAccessibilityEvent(event);
|
protected void | onRestoreInstanceState(android.os.Parcelable state)
BaseSavedState ss = (BaseSavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
mDelegate.onRestoreInstanceState(ss);
|
protected android.os.Parcelable | onSaveInstanceState()
Parcelable superState = super.onSaveInstanceState();
return mDelegate.onSaveInstanceState(superState);
|
public void | setCalendarViewShown(boolean shown)Sets whether the {@link CalendarView} is shown.
Calling this method has no effect when the
{@link android.R.styleable#DatePicker_datePickerMode} attribute is set
to {@code calendar}.
mDelegate.setCalendarViewShown(shown);
|
public void | setEnabled(boolean enabled)
if (mDelegate.isEnabled() == enabled) {
return;
}
super.setEnabled(enabled);
mDelegate.setEnabled(enabled);
|
public void | setFirstDayOfWeek(int firstDayOfWeek)Sets the first day of week.
if (firstDayOfWeek < Calendar.SUNDAY || firstDayOfWeek > Calendar.SATURDAY) {
throw new IllegalArgumentException("firstDayOfWeek must be between 1 and 7");
}
mDelegate.setFirstDayOfWeek(firstDayOfWeek);
|
public void | setMaxDate(long maxDate)Sets the maximal date supported by this {@link DatePicker} in
milliseconds since January 1, 1970 00:00:00 in
{@link TimeZone#getDefault()} time zone.
mDelegate.setMaxDate(maxDate);
|
public void | setMinDate(long minDate)Sets the minimal date supported by this {@link NumberPicker} in
milliseconds since January 1, 1970 00:00:00 in
{@link TimeZone#getDefault()} time zone.
mDelegate.setMinDate(minDate);
|
public void | setSpinnersShown(boolean shown)Sets whether the spinners are shown.
mDelegate.setSpinnersShown(shown);
|
public void | setValidationCallback(android.widget.DatePicker$ValidationCallback callback)Sets the callback that indicates the current date is valid.
mDelegate.setValidationCallback(callback);
|
public void | updateDate(int year, int month, int dayOfMonth)Update the current date.
mDelegate.updateDate(year, month, dayOfMonth);
|