FileDocCategorySizeDatePackage
CalendarViewMaterialDelegate.javaAPI DocAndroid 5.1 API7211Thu Mar 12 22:22:10 GMT 2015android.widget

CalendarViewMaterialDelegate

public class CalendarViewMaterialDelegate extends CalendarView.AbstractCalendarViewDelegate

Fields Summary
private final DayPickerView
mDayPickerView
private CalendarView.OnDateChangeListener
mOnDateChangeListener
private final DayPickerView.OnDaySelectedListener
mOnDaySelectedListener
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 longgetDate()

        return mDayPickerView.getDate();
    
public intgetDateTextAppearance()

        return 0;
    
public intgetFirstDayOfWeek()

        return mDayPickerView.getFirstDayOfWeek();
    
public intgetFocusedMonthDateColor()

        return 0;
    
public longgetMaxDate()

        return mDayPickerView.getMaxDate();
    
public longgetMinDate()

        return mDayPickerView.getMinDate();
    
public android.graphics.drawable.DrawablegetSelectedDateVerticalBar()

        // Deprecated.
        return null;
    
public intgetSelectedWeekBackgroundColor()

        return 0;
    
public booleangetShowWeekNumber()

        // Deprecated.
        return false;
    
public intgetShownWeekCount()

        // Deprecated.
        return 0;
    
public intgetUnfocusedMonthDateColor()

        return 0;
    
public intgetWeekDayTextAppearance()

        return 0;
    
public intgetWeekNumberColor()

        // Deprecated.
        return 0;
    
public intgetWeekSeparatorLineColor()

        // Deprecated.
        return 0;
    
public voidonConfigurationChanged(android.content.res.Configuration newConfig)

        // Nothing to do here, configuration changes are already propagated
        // by ViewGroup.
    
private longparseDateToMillis(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 voidsetDate(long date)

        mDayPickerView.setDate(date, true, false);
    
public voidsetDate(long date, boolean animate, boolean center)

        mDayPickerView.setDate(date, animate, center);
    
public voidsetDateTextAppearance(int resourceId)


    
public voidsetFirstDayOfWeek(int firstDayOfWeek)

        mDayPickerView.setFirstDayOfWeek(firstDayOfWeek);
    
public voidsetFocusedMonthDateColor(int color)

        // TODO: Should use a ColorStateList. Deprecate?
    
public voidsetMaxDate(long maxDate)

        mDayPickerView.setMaxDate(maxDate);
    
public voidsetMinDate(long minDate)

        mDayPickerView.setMinDate(minDate);
    
public voidsetOnDateChangeListener(CalendarView.OnDateChangeListener listener)

        mOnDateChangeListener = listener;
    
public voidsetSelectedDateVerticalBar(int resourceId)

        // Deprecated.
    
public voidsetSelectedDateVerticalBar(android.graphics.drawable.Drawable drawable)

        // Deprecated.
    
public voidsetSelectedWeekBackgroundColor(int color)

        // TODO: Should use a ColorStateList. Deprecate?
    
public voidsetShowWeekNumber(boolean showWeekNumber)

        // Deprecated.
    
public voidsetShownWeekCount(int count)

        // Deprecated.
    
public voidsetUnfocusedMonthDateColor(int color)

        // TODO: Should use a ColorStateList. Deprecate?
    
public voidsetWeekDayTextAppearance(int resourceId)


    
public voidsetWeekNumberColor(int color)

        // Deprecated.
    
public voidsetWeekSeparatorLineColor(int color)

        // Deprecated.