public class MaterialCalendarView
extends android.view.ViewGroup
This class is a calendar widget for displaying and selecting dates. The range of dates supported by this calendar is configurable. A user can select a date by taping on it and can page the calendar to a desired date.
By default, the range of dates shown is from 200 years in the past to 200 years in the future. This can be extended or shortened by configuring the minimum and maximum dates.
When selecting a date out of range, or when the range changes so the selection becomes outside, The date closest to the previous selection will become selected. This will also trigger the OnDateSelectedListener
Note: if this view's size isn't divisible by 7, the contents will be centered inside such that the days in the calendar are equally square. For example, 600px isn't divisible by 7, so a tile size of 85 is choosen, making the calendar 595px wide. The extra 5px are distributed left and right to get to 600px.
Modifier and Type | Class and Description |
---|---|
static class |
MaterialCalendarView.SavedState |
static interface |
MaterialCalendarView.SelectionMode
IntDef annotation for selection mode.
|
static interface |
MaterialCalendarView.ShowOtherDates
IntDef annotation for showOtherDates.
|
class |
MaterialCalendarView.State |
class |
MaterialCalendarView.StateBuilder |
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TILE_SIZE_DP
Default tile size in DIPs.
|
static int |
HORIZONTAL
Use this orientation to animate the title horizontally
|
static int |
INVALID_TILE_DIMENSION |
static int |
SELECTION_MODE_MULTIPLE
Selection mode which allows more than one selected date at one time.
|
static int |
SELECTION_MODE_NONE
Selection mode that disallows all selection.
|
static int |
SELECTION_MODE_RANGE
Selection mode which allows selection of a range between two dates
|
static int |
SELECTION_MODE_SINGLE
Selection mode that allows one selected date at one time.
|
static int |
SHOW_ALL
Show all the days
|
static int |
SHOW_DECORATED_DISABLED
Show days that are individually disabled with decorators.
|
static int |
SHOW_DEFAULTS
The default flags for showing non-enabled dates.
|
static int |
SHOW_NONE
Do not show any non-enabled dates
|
static int |
SHOW_OTHER_MONTHS
Show dates from the proceeding and successive months, in a disabled state.
|
static int |
SHOW_OUT_OF_RANGE
Show dates that are outside of the min-max range.
|
static int |
VERTICAL
Use this orientation to animate the title vertically
|
FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VISIBLE, X, Y, Z
Constructor and Description |
---|
MaterialCalendarView(android.content.Context context) |
MaterialCalendarView(android.content.Context context,
android.util.AttributeSet attrs) |
Modifier and Type | Method and Description |
---|---|
void |
addDecorator(DayViewDecorator decorator)
Add a day decorator
|
void |
addDecorators(java.util.Collection<? extends DayViewDecorator> decorators)
Add a collection of day decorators
|
void |
addDecorators(DayViewDecorator... decorators)
Add several day decorators
|
boolean |
allowClickDaysOutsideCurrentMonth() |
boolean |
canGoBack()
TODO should this be public?
|
boolean |
canGoForward()
TODO should this be public?
|
void |
clearSelection()
Clear the currently selected date(s)
|
com.prolificinteractive.materialcalendarview.MaterialCalendarView.LayoutParams |
generateLayoutParams(android.util.AttributeSet attrs) |
int |
getArrowColor() |
java.lang.CharSequence |
getCalendarContentDescription()
Get content description for calendar
|
CalendarDay |
getCurrentDate() |
int |
getFirstDayOfWeek() |
android.graphics.drawable.Drawable |
getLeftArrowMask() |
CalendarDay |
getMaximumDate() |
CalendarDay |
getMinimumDate() |
android.graphics.drawable.Drawable |
getRightArrowMask() |
CalendarDay |
getSelectedDate() |
java.util.List<CalendarDay> |
getSelectedDates() |
int |
getSelectionColor() |
int |
getSelectionMode()
Get the current selection mode.
|
int |
getShowOtherDates() |
int |
getTileHeight() |
int |
getTileSize()
Deprecated.
|
int |
getTileWidth() |
int |
getTitleAnimationOrientation()
Get the orientation of the animation of the title.
|
boolean |
getTopbarVisible() |
void |
goToNext()
Go to next month or week without using the button
buttonFuture . |
void |
goToPrevious()
Go to previous month or week without using the button
buttonPast . |
void |
invalidateDecorators()
Invalidate decorators after one has changed internally.
|
boolean |
isDynamicHeightEnabled() |
boolean |
isPagingEnabled() |
MaterialCalendarView.StateBuilder |
newState()
Initialize the parameters from scratch.
|
void |
onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event) |
void |
onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info) |
boolean |
onTouchEvent(android.view.MotionEvent event)
Pass all touch events to the pager so scrolling works on the edges of the calendar view.
|
void |
removeDecorator(DayViewDecorator decorator)
Remove a specific decorator instance.
|
void |
removeDecorators()
Remove all decorators
|
void |
selectRange(CalendarDay firstDay,
CalendarDay lastDay)
Select a fresh range of date including first day and last day.
|
void |
setAllowClickDaysOutsideCurrentMonth(boolean enabled)
Allow the user to click on dates from other months that are not out of range.
|
void |
setArrowColor(int color) |
void |
setContentDescriptionArrowFuture(java.lang.CharSequence description)
Set content description for button future
|
void |
setContentDescriptionArrowPast(java.lang.CharSequence description)
Set content description for button past
|
void |
setContentDescriptionCalendar(java.lang.CharSequence description)
Set content description for calendar
|
void |
setCurrentDate(java.util.Calendar calendar) |
void |
setCurrentDate(CalendarDay day) |
void |
setCurrentDate(CalendarDay day,
boolean useSmoothScroll) |
void |
setCurrentDate(java.util.Date date) |
void |
setDateSelected(java.util.Calendar calendar,
boolean selected) |
void |
setDateSelected(CalendarDay day,
boolean selected) |
void |
setDateSelected(java.util.Date date,
boolean selected) |
void |
setDateTextAppearance(int resourceId) |
void |
setDayFormatter(DayFormatter formatter)
Set a formatter for day labels.
|
void |
setDynamicHeightEnabled(boolean useDynamicHeight)
By default, the calendar will take up all the space needed to show any month (6 rows).
|
void |
setHeaderTextAppearance(int resourceId) |
void |
setLeftArrowMask(android.graphics.drawable.Drawable icon) |
void |
setOnDateChangedListener(OnDateSelectedListener listener)
Sets the listener to be notified upon selected date changes.
|
void |
setOnMonthChangedListener(OnMonthChangedListener listener)
Sets the listener to be notified upon month changes.
|
void |
setOnRangeSelectedListener(OnRangeSelectedListener listener)
Sets the listener to be notified upon a range has been selected.
|
void |
setOnTitleClickListener(android.view.View.OnClickListener listener)
Add listener to the title or null to remove it.
|
void |
setPagingEnabled(boolean pagingEnabled)
Enable or disable the ability to swipe between months.
|
void |
setRightArrowMask(android.graphics.drawable.Drawable icon) |
void |
setSelectedDate(java.util.Calendar calendar) |
void |
setSelectedDate(CalendarDay date) |
void |
setSelectedDate(java.util.Date date) |
void |
setSelectionColor(int color) |
void |
setSelectionMode(int mode)
Change the selection mode of the calendar.
|
void |
setShowOtherDates(int showOtherDates)
The default value is
SHOW_DEFAULTS , which currently is just SHOW_DECORATED_DISABLED . |
void |
setTileHeight(int height)
Set the height of each tile that makes up the calendar.
|
void |
setTileHeightDp(int tileHeightDp) |
void |
setTileSize(int size)
Set the size of each tile that makes up the calendar.
|
void |
setTileSizeDp(int tileSizeDp) |
void |
setTileWidth(int width)
Set the width of each tile that makes up the calendar.
|
void |
setTileWidthDp(int tileWidthDp) |
void |
setTitleAnimationOrientation(int orientation)
Change the title animation orientation to have a different look and feel.
|
void |
setTitleFormatter(TitleFormatter titleFormatter)
Set a custom formatter for the month/year title
|
void |
setTitleMonths(java.lang.CharSequence[] monthLabels)
Set a TitleFormatter
using the provided month labels
|
void |
setTitleMonths(int arrayRes)
Set a TitleFormatter
using the provided month labels
|
void |
setTopbarVisible(boolean visible)
Sets the visibility
topbar , which contains
the previous month button buttonPast , next month button buttonFuture ,
and the month title title . |
void |
setWeekDayFormatter(WeekDayFormatter formatter)
Set a formatter for weekday labels.
|
void |
setWeekDayLabels(java.lang.CharSequence[] weekDayLabels)
Set a WeekDayFormatter
with the provided week day labels
|
void |
setWeekDayLabels(int arrayRes)
Set a WeekDayFormatter
with the provided week day labels
|
void |
setWeekDayTextAppearance(int resourceId) |
boolean |
shouldDelayChildPressedState() |
static boolean |
showDecoratedDisabled(int showOtherDates) |
static boolean |
showOtherMonths(int showOtherDates) |
static boolean |
showOutOfRange(int showOtherDates) |
MaterialCalendarView.State |
state()
Preserve the current parameters of the Material Calendar View.
|
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchSetActivated, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getAccessibilityClassName, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, dispatchStartTemporaryDetach, draw, drawableHotspotChanged, findViewById, findViewWithTag, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onCreateInputConnection, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRtlPropertiesChanged, onScreenStateChanged, onStartTemporaryDetach, onTrackballEvent, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayout
public static final int INVALID_TILE_DIMENSION
public static final int SELECTION_MODE_NONE
public static final int SELECTION_MODE_SINGLE
public static final int SELECTION_MODE_MULTIPLE
public static final int SELECTION_MODE_RANGE
public static final int SHOW_NONE
public static final int SHOW_OTHER_MONTHS
SHOW_OUT_OF_RANGE
flag to prevent odd blank areas.public static final int SHOW_OUT_OF_RANGE
SHOW_OTHER_MONTHS
is enabled.public static final int SHOW_DECORATED_DISABLED
public static final int SHOW_DEFAULTS
SHOW_DECORATED_DISABLED
public static final int SHOW_ALL
public static final int VERTICAL
public static final int HORIZONTAL
public static final int DEFAULT_TILE_SIZE_DP
public MaterialCalendarView(android.content.Context context)
public MaterialCalendarView(android.content.Context context, android.util.AttributeSet attrs)
public void setSelectionMode(int mode)
mode
- the selection mode to change to. This must be one of
SELECTION_MODE_NONE, SELECTION_MODE_SINGLE,
SELECTION_MODE_RANGE or SELECTION_MODE_MULTIPLE.
Unknown values will act as SELECTION_MODE_SINGLEgetSelectionMode()
,
SELECTION_MODE_NONE
,
SELECTION_MODE_SINGLE
,
SELECTION_MODE_MULTIPLE
,
SELECTION_MODE_RANGE
public void goToPrevious()
buttonPast
. Should only go to
previous if canGoBack()
is true, meaning it's possible to go to the previous month
or week.public void goToNext()
buttonFuture
. Should only go to
next if canGoForward()
is enabled, meaning it's possible to go to the next month or
week.public int getSelectionMode()
setSelectionMode(int)
,
SELECTION_MODE_NONE
,
SELECTION_MODE_SINGLE
,
SELECTION_MODE_MULTIPLE
,
SELECTION_MODE_RANGE
@Deprecated public int getTileSize()
getTileWidth()
or getTileHeight()
instead. This method is deprecated
and will just return the largest of the two sizes.public void setTileSize(int size)
topbar
.size
- the new size for each tile in pixelspublic void setTileSizeDp(int tileSizeDp)
tileSizeDp
- the new size for each tile in dipssetTileSize(int)
public int getTileHeight()
public void setTileHeight(int height)
height
- the new height for each tile in pixelspublic void setTileHeightDp(int tileHeightDp)
tileHeightDp
- the new height for each tile in dipssetTileHeight(int)
public int getTileWidth()
public void setTileWidth(int width)
width
- the new width for each tile in pixelspublic void setTileWidthDp(int tileWidthDp)
tileWidthDp
- the new width for each tile in dipssetTileWidth(int)
public boolean canGoForward()
public boolean onTouchEvent(android.view.MotionEvent event)
onTouchEvent
in class android.view.View
event
- public boolean canGoBack()
public int getSelectionColor()
public void setSelectionColor(int color)
color
- The selection colorpublic int getArrowColor()
public void setArrowColor(int color)
color
- the new color for the paging arrowspublic void setContentDescriptionArrowPast(java.lang.CharSequence description)
description
- String to use as content descriptionpublic void setContentDescriptionArrowFuture(java.lang.CharSequence description)
description
- String to use as content descriptionpublic void setContentDescriptionCalendar(java.lang.CharSequence description)
description
- String to use as content descriptionpublic java.lang.CharSequence getCalendarContentDescription()
public android.graphics.drawable.Drawable getLeftArrowMask()
public void setLeftArrowMask(android.graphics.drawable.Drawable icon)
icon
- the new icon to use for the left paging arrowpublic android.graphics.drawable.Drawable getRightArrowMask()
public void setRightArrowMask(android.graphics.drawable.Drawable icon)
icon
- the new icon to use for the right paging arrowpublic void setHeaderTextAppearance(int resourceId)
resourceId
- The text appearance resource id.public void setDateTextAppearance(int resourceId)
resourceId
- The text appearance resource id.public void setWeekDayTextAppearance(int resourceId)
resourceId
- The text appearance resource id.public CalendarDay getSelectedDate()
@NonNull public java.util.List<CalendarDay> getSelectedDates()
public void clearSelection()
public void setSelectedDate(@Nullable java.util.Calendar calendar)
calendar
- a Calendar set to a day to select. Null to clear selectionpublic void setSelectedDate(@Nullable java.util.Date date)
date
- a Date to set as selected. Null to clear selectionpublic void setSelectedDate(@Nullable CalendarDay date)
date
- a Date to set as selected. Null to clear selectionpublic void setDateSelected(@Nullable java.util.Calendar calendar, boolean selected)
calendar
- a Calendar to change. Passing null does nothingselected
- true if day should be selected, false to deselectpublic void setDateSelected(@Nullable java.util.Date date, boolean selected)
date
- a Date to change. Passing null does nothingselected
- true if day should be selected, false to deselectpublic void setDateSelected(@Nullable CalendarDay day, boolean selected)
day
- a CalendarDay to change. Passing null does nothingselected
- true if day should be selected, false to deselectpublic void setCurrentDate(@Nullable java.util.Calendar calendar)
calendar
- a Calendar set to a day to focus the calendar on. Null will do nothingpublic void setCurrentDate(@Nullable java.util.Date date)
date
- a Date to focus the calendar on. Null will do nothingpublic CalendarDay getCurrentDate()
public void setCurrentDate(@Nullable CalendarDay day)
day
- a CalendarDay to focus the calendar on. Null will do nothingpublic void setCurrentDate(@Nullable CalendarDay day, boolean useSmoothScroll)
day
- a CalendarDay to focus the calendar on. Null will do nothinguseSmoothScroll
- use smooth scroll when changing months.public CalendarDay getMinimumDate()
public CalendarDay getMaximumDate()
public void setShowOtherDates(int showOtherDates)
SHOW_DEFAULTS
, which currently is just SHOW_DECORATED_DISABLED
.
This means that the default visible days are of the current month, in the min-max range.showOtherDates
- flags for showing non-enabled datesSHOW_ALL
,
SHOW_NONE
,
SHOW_DEFAULTS
,
SHOW_OTHER_MONTHS
,
SHOW_OUT_OF_RANGE
,
SHOW_DECORATED_DISABLED
public void setAllowClickDaysOutsideCurrentMonth(boolean enabled)
SHOW_OTHER_MONTHS
.enabled
- True to allow the user to click on a day outside current month displayedpublic void setWeekDayFormatter(WeekDayFormatter formatter)
formatter
- the new formatter, null for defaultpublic void setDayFormatter(DayFormatter formatter)
formatter
- the new formatter, null for defaultpublic void setWeekDayLabels(java.lang.CharSequence[] weekDayLabels)
weekDayLabels
- Labels to use for the days of the weekArrayWeekDayFormatter
,
setWeekDayFormatter(com.prolificinteractive.materialcalendarview.format.WeekDayFormatter)
public void setWeekDayLabels(@ArrayRes int arrayRes)
arrayRes
- String array resource of week day labelsArrayWeekDayFormatter
,
setWeekDayFormatter(com.prolificinteractive.materialcalendarview.format.WeekDayFormatter)
public int getShowOtherDates()
SHOW_ALL
,
SHOW_NONE
,
SHOW_DEFAULTS
,
SHOW_OTHER_MONTHS
,
SHOW_OUT_OF_RANGE
,
SHOW_DECORATED_DISABLED
public boolean allowClickDaysOutsideCurrentMonth()
public void setTitleFormatter(TitleFormatter titleFormatter)
titleFormatter
- new formatter to use, null to use default formatterpublic void setTitleMonths(java.lang.CharSequence[] monthLabels)
monthLabels
- month labels to useMonthArrayTitleFormatter
,
setTitleFormatter(com.prolificinteractive.materialcalendarview.format.TitleFormatter)
public void setTitleMonths(@ArrayRes int arrayRes)
arrayRes
- String array resource of month labels to useMonthArrayTitleFormatter
,
setTitleFormatter(com.prolificinteractive.materialcalendarview.format.TitleFormatter)
public void setTitleAnimationOrientation(int orientation)
orientation
- VERTICAL
or HORIZONTAL
public int getTitleAnimationOrientation()
VERTICAL
or HORIZONTAL
public void setTopbarVisible(boolean visible)
topbar
, which contains
the previous month button buttonPast
, next month button buttonFuture
,
and the month title title
.visible
- Boolean indicating if the topbar is visiblepublic boolean getTopbarVisible()
public int getFirstDayOfWeek()
public void setDynamicHeightEnabled(boolean useDynamicHeight)
This means months that only need 5 or 4 rows to show the entire month will only take up that many rows, and will grow and shrink as necessary.
useDynamicHeight
- true to have the view different heights based on the visible monthpublic boolean isDynamicHeightEnabled()
public void addDecorators(java.util.Collection<? extends DayViewDecorator> decorators)
decorators
- decorators to addpublic void addDecorators(DayViewDecorator... decorators)
decorators
- decorators to addpublic void addDecorator(DayViewDecorator decorator)
decorator
- decorator to addpublic void removeDecorators()
public void removeDecorator(DayViewDecorator decorator)
decorator
- decorator to removepublic void invalidateDecorators()
public void setOnDateChangedListener(OnDateSelectedListener listener)
listener
- thing to be notifiedpublic void setOnMonthChangedListener(OnMonthChangedListener listener)
listener
- thing to be notifiedpublic void setOnRangeSelectedListener(OnRangeSelectedListener listener)
listener
- thing to be notifiedpublic void setOnTitleClickListener(android.view.View.OnClickListener listener)
listener
- Listener to be notified.public void selectRange(CalendarDay firstDay, CalendarDay lastDay)
firstDay
- first day of the range to selectlastDay
- last day of the range to selectpublic static boolean showOtherMonths(int showOtherDates)
showOtherDates
- int flag for show other datespublic static boolean showOutOfRange(int showOtherDates)
showOtherDates
- int flag for show other datespublic static boolean showDecoratedDisabled(int showOtherDates)
showOtherDates
- int flag for show other datespublic com.prolificinteractive.materialcalendarview.MaterialCalendarView.LayoutParams generateLayoutParams(android.util.AttributeSet attrs)
generateLayoutParams
in class android.view.ViewGroup
public boolean shouldDelayChildPressedState()
shouldDelayChildPressedState
in class android.view.ViewGroup
public void onInitializeAccessibilityEvent(@NonNull android.view.accessibility.AccessibilityEvent event)
onInitializeAccessibilityEvent
in class android.view.View
public void onInitializeAccessibilityNodeInfo(@NonNull android.view.accessibility.AccessibilityNodeInfo info)
onInitializeAccessibilityNodeInfo
in class android.view.View
public void setPagingEnabled(boolean pagingEnabled)
pagingEnabled
- pass false to disable paging, true to enable (default)public boolean isPagingEnabled()
public MaterialCalendarView.State state()
public MaterialCalendarView.StateBuilder newState()