public class CalendarFragment extends CalendarElement
CalendarDisplayMode
and can be of the shape
of a rectangle or jagged if trimmed (vertical month mode).BOTTOM, CENTER, CENTER_HORIZONTAL, CENTER_VERTICAL, LEFT, RIGHT, TOP
Constructor and Description |
---|
CalendarFragment(RadCalendarView owner)
Creates a new instance of the
CalendarFragment class. |
Modifier and Type | Method and Description |
---|---|
int |
firstFullRowIndex()
Gets the index of the first row, that holds only cells, which date is from the same range like the current display date for the fragment.
|
CalendarCell |
getCellAtLocation(int x,
int y)
Gets a cell at certain location having in mind the virtual position of the fragment.
|
CalendarCell |
getCellForDate(long date)
Returns an instance of the
CalendarCell class representing the date cell
for the provided Long date. |
long |
getDisplayDate()
Gets the current display date that is represented by this fragment instance.
|
CalendarDisplayMode |
getDisplayMode()
Gets the current display mode.
|
int |
getVirtualXPosition()
Deprecated.
|
int |
getVirtualYPosition()
Deprecated.
|
boolean |
isCurrentFragment()
Gets a value that determines whether this is the current fragment or not.
|
int |
lastRowWithCurrentDateCellsIndex()
Gets the index of the last row, that has at least one cell from the same range like the current display date for the fragment.
|
void |
postRender(Canvas canvas)
This method is called after calling the
CalendarElement.render(android.graphics.Canvas) method. |
void |
postRender(Canvas canvas,
boolean drawDecorations)
Extends the post render logic by adding the option to draw the decorations.
|
void |
recycle()
Clears all content from the fragment.
|
void |
render(Canvas canvas)
This method is called at onDraw() call from the main calendar view instance and is used for drawing all custom elements building the calendar structure.
|
void |
render(Canvas canvas,
boolean drawDecorations)
Extends the render logic, adds the option to state specifically whether the decorations should be
drawn during the render phase, or later in the postRender phase.
|
void |
reset()
Resets the current fragment instance.
|
void |
reset(CalendarDisplayMode forDisplayMode)
Resets the current fragment by rebuilding its structure based on the provided display mode.
|
double |
rowHeight()
Gets the getHeight of a single row contained inside the fragment, where all rows have the same getHeight at all times.
|
ArrayList<CalendarRow> |
rows()
The collection holding the rows for the current fragment instance.
|
void |
setCurrentFragment(boolean currentFragment)
Sets a value that determines whether this is the current fragment or not.
|
void |
setDisplayDate(long displayDate)
Sets the current display date that is represented by this fragment instance.
|
void |
setDisplayMode(CalendarDisplayMode displayMode)
Sets the current display mode.
|
void |
setEnabled(boolean enabled)
Sets a value determining whether the current element is enabled.
|
void |
setVirtualOffsets(int offsetX,
int offsetY)
Sets the virtual offsets of the element along the x and y axes.
|
void |
setVirtualXPosition(int virtualXPosition)
Deprecated.
|
void |
setVirtualYPosition(int virtualYPosition)
Deprecated.
|
void |
trim()
Used to trim the cells before and after the ones that are in the same range as the current display date of the fragment.
|
void |
updateDecorations()
Used to update the decorations for the cells of the current fragment instance, so that they are ready for rendering.
|
arrange, calcBorderRect, getAlpha, getBackgroundColorDisabled, getBackgroundColorEnabled, getBitmap, getBitmapPosition, getBottom, getHeight, getLeft, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getRight, getTop, getVirtualOffsetX, getVirtualOffsetY, getVisibility, getWidth, isEnabled, pointIsInsideElement, setAlpha, setBackgroundColor, setBackgroundColorDisabled, setBackgroundColorEnabled, setBitmap, setBitmapPosition, setPadding, setPaddingHorizontal, setPaddingVertical, setParent, setVirtualOffsetX, setVirtualOffsetY, setVisibility, translate, virtualBottom, virtualLeft, virtualRight, virtualTop, virtualTranslate
public CalendarFragment(RadCalendarView owner)
CalendarFragment
class.owner
- the current calendar view instance that owns the fragment.public boolean isCurrentFragment()
true
if this is the current fragment, false
otherwise.public void setCurrentFragment(boolean currentFragment)
currentFragment
- the new current state.public CalendarDisplayMode getDisplayMode()
public void setDisplayMode(CalendarDisplayMode displayMode)
displayMode
- the new display mode.public int getVirtualXPosition()
public void setVirtualXPosition(int virtualXPosition)
virtualXPosition
- the new virtual x position.public int getVirtualYPosition()
public void setVirtualYPosition(int virtualYPosition)
virtualYPosition
- the new virtual y position.public long getDisplayDate()
public void setDisplayDate(long displayDate)
displayDate
- the new display date.public int firstFullRowIndex()
trim()
is being invoked.public int lastRowWithCurrentDateCellsIndex()
trim()
has been invoked.public void setEnabled(boolean enabled)
CalendarElement
setEnabled
in class CalendarElement
enabled
- the new enabled state.public double rowHeight()
public ArrayList<CalendarRow> rows()
public void render(Canvas canvas)
CalendarElement
render
in class CalendarElement
canvas
- the canvas of the main calendar view instance.public void render(Canvas canvas, boolean drawDecorations)
canvas
- the current canvas.drawDecorations
- true
will result in drawing the decorations in the render phase, false
will halt the operation, so that
post render can handle it.public void postRender(Canvas canvas)
CalendarElement
CalendarElement.render(android.graphics.Canvas)
method.postRender
in class CalendarElement
canvas
- the canvas of the main calendar view instance.public void setVirtualOffsets(int offsetX, int offsetY)
CalendarElement
setVirtualOffsets
in class CalendarElement
offsetX
- the new virtual offset along the x axis.offsetY
- the new virtual offset along the y axis.public void postRender(Canvas canvas, boolean drawDecorations)
canvas
- the current canvas.drawDecorations
- true
will result in drawing the decorations, false
will halt the operation.public void trim()
public void reset()
public void reset(CalendarDisplayMode forDisplayMode)
forDisplayMode
- the CalendarDisplayMode
value to rebuild for.public CalendarCell getCellAtLocation(int x, int y)
x
- the x position of the cell before switching to virtual coordinates.y
- the y position of the cell before switching to virtual coordinates.null
if no cell is found.public CalendarCell getCellForDate(long date)
CalendarCell
class representing the date cell
for the provided Long
date.date
- the date to return the cell for.CalendarCell
displaying the provided date.public void updateDecorations()
public void recycle()