MagicMashRoom / SuperCalendar

@Deprecated android 自定义日历控件 支持左右无限滑动 周月切换 标记日期显示 自定义显示效果跳转到指定日期
2.76k stars 484 forks source link

Max and Min date range #132

Closed monowar1993 closed 4 years ago

monowar1993 commented 6 years ago

Hello Is there an way to add max and min date range? Also how can I jump to a specific date?

avp90 commented 6 years ago

You can select a date like this:

/*
 * Should only be called, when view is inflated and visible (e.g. determine by focus).
 */
private fun selectToday() {
    val today = SuperCalendarDate()
    mCalendarAdapter.notifyDataChanged(today)
}
monowar1993 commented 6 years ago

It going to today. But what I want to go to 22-10-2016

monowar1993 commented 6 years ago

@adrianpop1990 is there any way to set and get max and min year.

avp90 commented 6 years ago

It going to today. But what I want to go to 22-10-2016

If you want to select the date 22-10-2016, you can use this function:

/*
 * Should only be called, when view is inflated and visible (e.g. determine by focus).
 */
private fun selectDay(year: Int, month: Int, day: Int) {
    val date = SuperCalendarDate(year, month, day)
    mCalendarAdapter.notifyDataChanged(date)
}

@adrianpop1990 is there any way to set and get max and min year.

I don't saw any method to set or get the max and min year. If you need this feature, you can create a fork and implement it. The structure of the calendar is easy to understand, so it should not be hard to do this.