### Set pre selected dates
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets a pre-selected date range on the calendar. The start date is one month before the current date and the end date is 40 days after the start date.
```Java
Calendar startSelectionDate = Calendar.getInstance();
startSelectionDate.add(Calendar.MONTH, -1);
Calendar endSelectionDate = (Calendar) startSelectionDate.clone();
endSelectionDate.add(Calendar.DATE, 40);
calendar.setSelectedDateRange(startSelectionDate, endSelectionDate);
```
--------------------------------
### setFonts
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the typeface used for text within the calendar.
```APIDOC
## setFonts
### Description
Sets the typeface used for text within the calendar.
### Method
setFonts
### Parameters
- **typeface** (Typeface) - Required - The typeface to apply to calendar text.
### Request Example
```java
Typeface typeface = Typeface.createFromAsset(getAssets(), "Roboto.ttf");
calendar.setFonts(typeface);
```
```
--------------------------------
### setWeekOffset
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the first day of the week for the calendar display.
```APIDOC
## setWeekOffset
### Description
Sets the first day of the week for the calendar display.
### Method
setWeekOffset
### Parameters
- **offset** (int) - Required - The day offset: 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday.
### Request Example
```java
calendar.setWeekOffset(1);
```
```
--------------------------------
### Set calendar months range
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Defines the visible month range for the calendar. The start month is two months before the current month and the end month is five months after the current month.
```Java
Calendar startMonth = Calendar.getInstance();
startMonth.add(Calendar.MONTH, -2);
Calendar endMonth = (Calendar) now.clone();
endMonth.add(Calendar.MONTH, 5);
calendar.setVisibleMonthRange(startMonth,endMonth);
```
--------------------------------
### Add Gradle dependency for awesome-calendar
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Add this line to the app-level Gradle file to import the CalendarDateRangePicker library. The dependency is 'io.github.architshah248.calendar:awesome-calendar:2.0.0'.
```gradle
dependencies {
implementation 'io.github.architshah248.calendar:awesome-calendar:2.0.0'
}
```
--------------------------------
### Define CalendarListener interface
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
This interface defines callbacks for date selection. Implement 'onFirstDateSelected' and 'onDateRangeSelected' to handle user interactions.
```java
public interface CalendarListener {
void onFirstDateSelected(Calendar startDate);
void onDateRangeSelected(Calendar startDate, Calendar endDate);
}
```
--------------------------------
### Add Maven dependency for awesome-calendar
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Add this dependency to your Maven pom.xml to import the CalendarDateRangePicker library. The artifact is 'awesome-calendar' version '2.0.0'.
```xml
io.github.architshah248.calendar
awesome-calendar
2.0.0
```
--------------------------------
### Set selectable date range
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Use this method to enable or disable past or future dates by specifying the selectable start and end dates.
```java
calendar.setSelectableDateRange(startDateSelectable, endDateSelectable);
```
--------------------------------
### setVisibleMonthRange
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the range of months that can be displayed on the calendar.
```APIDOC
## setVisibleMonthRange
### Description
Sets the range of months that can be displayed on the calendar.
### Method
setVisibleMonthRange
### Parameters
- **startMonth** (Calendar) - Required - The first month that can be displayed.
- **endMonth** (Calendar) - Required - The last month that can be displayed.
### Request Example
```java
Calendar startMonth = Calendar.getInstance();
startMonth.add(Calendar.MONTH, -2);
Calendar endMonth = (Calendar) now.clone();
endMonth.add(Calendar.MONTH, 5);
calendar.setVisibleMonthRange(startMonth,endMonth);
```
```
--------------------------------
### setCurrentMonth
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the currently visible month on the calendar.
```APIDOC
## setCurrentMonth
### Description
Sets the currently visible month on the calendar.
### Method
setCurrentMonth
### Parameters
- **current** (Calendar) - Required - The calendar instance representing the month to display.
### Request Example
```java
Calendar current = Calendar.getInstance();
calendar.setCurrentMonth(current);
```
```
--------------------------------
### Set calendar listener with callbacks
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Attach a CalendarListener to the calendar view. The callbacks show Toast messages with the selected dates.
```java
calendar.setCalendarListener(new CalendarListener() {
@Override
public void onFirstDateSelected(Calendar startDate) {
Toast.makeText(MainActivity.this, "Start Date: " + startDate.getTime().toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onDateRangeSelected(Calendar startDate, Calendar endDate) {
Toast.makeText(MainActivity.this, "Start Date: " + startDate.getTime().toString() + " End date: " + endDate.getTime().toString(), Toast.LENGTH_SHORT).show();
}
});
```
--------------------------------
### setNavRightImage
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the drawable resource for the right navigation arrow of the calendar.
```APIDOC
## setNavRightImage
### Description
Sets the drawable resource for the right navigation arrow of the calendar.
### Method
setNavRightImage
### Parameters
- **drawable** (Drawable) - Required - The drawable to use for the right navigation arrow.
### Request Example
```java
calendar.setNavRightImage(ContextCompat.getDrawable(this,R.drawable.ic_right));
```
```
--------------------------------
### setSelectedDateRange
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the selected date range on the calendar. This programmatically selects the given start and end dates.
```APIDOC
## setSelectedDateRange
### Description
Sets the selected date range on the calendar. This programmatically selects the given start and end dates.
### Method
setSelectedDateRange
### Parameters
- **startDate** (Calendar) - Required - The start date of the range to select.
- **endDate** (Calendar) - Required - The end date of the range to select.
### Usage Example
```java
calendar.setSelectedDateRange(startDate, endDate);
```
```
--------------------------------
### Set text fonts
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets a custom Typeface for the calendar text. The font is loaded from the assets folder using the specified file name.
```Java
Typeface typeface = Typeface.createFromAsset(getAssets(), "Roboto.ttf");
calendar.setFonts(typeface);
```
--------------------------------
### setSelectedDateRange
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the pre-selected date range on the calendar.
```APIDOC
## setSelectedDateRange
### Description
Sets the pre-selected date range on the calendar.
### Method
setSelectedDateRange
### Parameters
- **startSelectionDate** (Calendar) - Required - The start date of the selection.
- **endSelectionDate** (Calendar) - Required - The end date of the selection.
### Request Example
```java
Calendar startSelectionDate = Calendar.getInstance();
startSelectionDate.add(Calendar.MONTH, -1);
Calendar endSelectionDate = (Calendar) startSelectionDate.clone();
endSelectionDate.add(Calendar.DATE, 40);
calendar.setSelectedDateRange(startSelectionDate, endSelectionDate);
```
```
--------------------------------
### Set current visible month on calendar
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the month currently visible on the calendar using a Calendar instance.
```java
Calendar current = Calendar.getInstance();
calendar.setCurrentMonth(current);
```
--------------------------------
### setNavLeftImage
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the drawable resource for the left navigation arrow of the calendar.
```APIDOC
## setNavLeftImage
### Description
Sets the drawable resource for the left navigation arrow of the calendar.
### Method
setNavLeftImage
### Parameters
- **drawable** (Drawable) - Required - The drawable to use for the left navigation arrow.
### Request Example
```java
calendar.setNavLeftImage(ContextCompat.getDrawable(this,R.drawable.ic_left));
```
```
--------------------------------
### Set days selection (only for FIXED_RANGE)
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the number of days that can be selected when the calendar is in FIXED_RANGE mode.
```Java
calendar.setFixedDaysSelection(6);
```
--------------------------------
### setFixedDaysSelection
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the number of days that can be selected when the calendar is in FIXED_RANGE mode.
```APIDOC
## setFixedDaysSelection
### Description
Sets the number of days that can be selected when the calendar is in FIXED_RANGE mode.
### Method
setFixedDaysSelection
### Parameters
- **days** (int) - Required - The number of days to select.
### Request Example
```java
calendar.setFixedDaysSelection(6);
```
```
--------------------------------
### Set navigation arrow left-right image
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Configures the left and right navigation arrow images on the calendar using drawable resources. Requires a ContextCompat drawable for each arrow.
```Java
calendar.setNavLeftImage(ContextCompat.getDrawable(this,R.drawable.ic_left));
calendar.setNavRightImage(ContextCompat.getDrawable(this,R.drawable.ic_right));
```
--------------------------------
### Set week offset
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the first day of the week. The offset value maps to days: 0-Sun, 1-Mon, 2-Tue, 3-Wed, 4-Thu, 5-Fri, 6-Sat.
```Java
calendar.setWeekOffset(1);
```
--------------------------------
### Set selected date range
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Use this method to programmatically set the selected date range on the calendar.
```java
calendar.setSelectedDateRange(startDate, endDate);
```
--------------------------------
### Add DateRangeCalendarView to layout XML
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Place this XML in your layout to add the DateRangeCalendarView. Customize appearance using attributes like 'custom:range_color' and 'custom:header_bg'.
```xml
```
--------------------------------
### resetAllSelectedViews
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Resets the calendar's date selection, clearing any selected dates or ranges.
```APIDOC
## resetAllSelectedViews
### Description
Resets the calendar's date selection, clearing any selected dates or ranges.
### Method
resetAllSelectedViews
### Usage Example
```java
calendar.resetAllSelectedViews();
```
```
--------------------------------
### Reset calendar date selection
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Call this method to clear all selected dates and reset the calendar to its initial state.
```java
calendar.resetAllSelectedViews();
```
--------------------------------
### setCalendarListener
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets a listener to receive callbacks when a date is selected or a date range is selected. The listener provides methods for the first date selected and the full range selected.
```APIDOC
## setCalendarListener
### Description
Sets a listener to receive callbacks when a date is selected or a date range is selected. The listener provides methods for the first date selected and the full range selected.
### Method
setCalendarListener
### Parameters
- **listener** (CalendarListener) - Required - The listener to receive date selection callbacks.
### Callback Interface
```java
public interface CalendarListener {
void onFirstDateSelected(Calendar startDate);
void onDateRangeSelected(Calendar startDate, Calendar endDate);
}
```
### Usage Example
```java
calendar.setCalendarListener(new CalendarListener() {
@Override
public void onFirstDateSelected(Calendar startDate) {
Toast.makeText(MainActivity.this, "Start Date: " + startDate.getTime().toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onDateRangeSelected(Calendar startDate, Calendar endDate) {
Toast.makeText(MainActivity.this, "Start Date: " + startDate.getTime().toString() + " End date: " + endDate.getTime().toString(), Toast.LENGTH_SHORT).show();
}
});
```
```
--------------------------------
### setSelectableDateRange
Source: https://github.com/architshah248/calendardaterangepicker/blob/master/README.md
Sets the selectable date range to enable or disable past or future dates. The calendar will only allow selection within the specified range.
```APIDOC
## setSelectableDateRange
### Description
Sets the selectable date range to enable or disable past or future dates. The calendar will only allow selection within the specified range.
### Method
setSelectableDateRange
### Parameters
- **startDateSelectable** (Calendar) - Required - The start date of the selectable range.
- **endDateSelectable** (Calendar) - Required - The end date of the selectable range.
### Usage Example
```java
calendar.setSelectableDateRange(startDateSelectable, endDateSelectable);
```
```