forked from yannecer/NCalendar
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/yannecer/NCalendar
- Loading branch information
Showing
3 changed files
with
158 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
|
||
#### CalendarAdapter 日历适配器,获取日历Item和日历背景,再通过onBoind...设置对应的数据,具体用法参见demo | ||
|
||
|
||
/** | ||
* 获取日历背景View,可用于做背景渐变等,不需要可不用实现 | ||
* | ||
* @param context | ||
* @return | ||
*/ | ||
public View getCalendarBackgroundView(Context context) { | ||
return null; | ||
} | ||
|
||
/** | ||
* 绑定日历背景View,不需要可不用实现 | ||
* | ||
* @param iCalendarView ICalendarView 日历页面,可判断是月日历或者周日历 | ||
* @param calendarBackgroundView 日历View,即是getCalendarBackgroundView获取的view | ||
* @param localDate | ||
* @param totalDistance 滑动的全部距离 | ||
* @param currentDistance 当前位置的距离 | ||
*/ | ||
public void onBindCalendarBackgroundView(ICalendarView iCalendarView, View calendarBackgroundView, LocalDate localDate, int totalDistance, int currentDistance) { | ||
|
||
} | ||
|
||
/** | ||
* 获取日历item的View | ||
* | ||
* @param context | ||
* @return | ||
*/ | ||
public abstract View getCalendarItemView(Context context); | ||
|
||
|
||
/** | ||
* 绑定今天的数据 | ||
* | ||
* @param calendarItemView | ||
* @param localDate | ||
* @param selectedDateList | ||
*/ | ||
public abstract void onBindToadyView(View calendarItemView, LocalDate localDate, List<LocalDate> selectedDateList); | ||
|
||
/** | ||
* 绑定除今天的当月数据 | ||
* | ||
* @param calendarItemView | ||
* @param localDate | ||
* @param selectedDateList | ||
*/ | ||
public abstract void onBindCurrentMonthOrWeekView(View calendarItemView, LocalDate localDate, List<LocalDate> selectedDateList); | ||
|
||
/** | ||
* 绑定上下月的数据 周日历可不用实现 | ||
* | ||
* @param calendarItemView | ||
* @param localDate | ||
* @param selectedDateList | ||
*/ | ||
public abstract void onBindLastOrNextMonthView(View calendarItemView, LocalDate localDate, List<LocalDate> selectedDateList); | ||
|
||
/** | ||
* 绑定不可用的日期数据,和方法setDateInterval(startFormatDate, endFormatDate)对应, | ||
* 如果没有使用setDateInterval设置日期范围 此方法不用实现 | ||
* | ||
* @param calendarItemView | ||
* @param localDate | ||
*/ | ||
public void onBindDisableDateView(View calendarItemView, LocalDate localDate) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
|
||
|
||
|
||
### CalendarPainter | ||
|
||
|
||
``` | ||
日历绘制接口,绘制的所有内容通过这个接口完成,实现这个类可实现自定义的日历界面, | ||
参数中的 rectF 是文字位置的矩形对象 | ||
日历内部内置了一个 InnerPainter ,各个属性也是这个绘制类的,如果自定义 CalendarPainter ,则这些属性都不适用 | ||
InnerPainter 实现了设置圆点、替换农历等方法,还可以实现更多方法,如多选,多标记等, | ||
/** | ||
* 绘制月日历或这日历背景,如数字背景等 | ||
* | ||
* @param iCalendarView ICalendarView 日历页面,可判断是月日历或者周日历 | ||
* @param canvas | ||
* @param rectF | ||
* @param localDate | ||
* @param totalDistance 滑动的全部距离 | ||
* @param currentDistance 当前位置的距离 | ||
*/ | ||
void onDrawCalendarBackground(ICalendarView iCalendarView, Canvas canvas, RectF rectF, LocalDate localDate, int totalDistance, int currentDistance); | ||
/** | ||
* 绘制今天的日期 | ||
* | ||
* @param canvas | ||
* @param rectF | ||
* @param localDate | ||
* @param selectedDateList 全部选中的日期集合 | ||
*/ | ||
void onDrawToday(Canvas canvas, RectF rectF, LocalDate localDate, List<LocalDate> selectedDateList); | ||
/** | ||
* 绘制当前月或周的日期 | ||
* | ||
* @param canvas | ||
* @param rectF | ||
* @param localDate | ||
* @param selectedDateList 全部选中的日期集合 | ||
*/ | ||
void onDrawCurrentMonthOrWeek(Canvas canvas, RectF rectF, LocalDate localDate, List<LocalDate> selectedDateList); | ||
/** | ||
* 绘制上一月,下一月的日期,周日历不用实现 | ||
* | ||
* @param canvas | ||
* @param rectF | ||
* @param localDate | ||
* @param selectedDateList 全部选中的日期集合 | ||
*/ | ||
void onDrawLastOrNextMonth(Canvas canvas, RectF rectF, LocalDate localDate, List<LocalDate> selectedDateList); | ||
/** | ||
* 绘制不可用的日期,和方法setDateInterval(startFormatDate, endFormatDate)对应, | ||
* 如果没有使用setDateInterval设置日期范围 此方法不用实现 | ||
* | ||
* @param canvas | ||
* @param rectF | ||
* @param localDate | ||
*/ | ||
void onDrawDisableDate(Canvas canvas, RectF rectF, LocalDate localDate); | ||
实现接口 CalendarPainter,分别重写以上几个方法,setCalendarPainter(calendarPainter)即可实现自定义日历界面 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters