Skip to content

Commit

Permalink
新增跳转月份的方法jumpMonth
Browse files Browse the repository at this point in the history
  • Loading branch information
yannecer committed Nov 13, 2019
1 parent 9cbd30b commit beeca2a
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 3 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
minSdkVersion 15
targetSdkVersion 28
versionCode 2
versionName "4.4.0"
versionName "4.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions ncalendar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "4.4.0"
versionName "4.4.1"
}
}

Expand All @@ -23,7 +23,7 @@ publish {
repoName = 'maven'//bintray仓库
groupId = 'com.necer.ncalendar'//jcenter上的路径
artifactId = 'ncalendar'//项目名称
publishVersion = '4.4.0'//版本号
publishVersion = '4.4.1'//版本号
desc = 'NCalendar'
website = 'https://github.com/yannecer/NCalendar'
}
23 changes: 23 additions & 0 deletions ncalendar/src/main/java/com/necer/calendar/BaseCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,29 @@ public void jumpDate(String formatDate) {
jump(jumpDate, true);
}


@Override
public void jumpDate(int year, int month, int day) {
LocalDate jumpDate;
try {
jumpDate = new LocalDate(year, month, day);
} catch (Exception e) {
throw new IllegalArgumentException("jumpDate的参数需要正确的年月日数据");
}
jump(jumpDate, true);
}

@Override
public void jumpMonth(int year, int month) {
LocalDate jumpDate;
try {
jumpDate = new LocalDate(year, month, 1);
} catch (Exception e) {
throw new IllegalArgumentException("jumpDate的参数需要正确的年月日数据");
}
jump(jumpDate, false);
}

@Override
public List<LocalDate> getAllSelectDateList() {
return mAllSelectDateList;
Expand Down
18 changes: 18 additions & 0 deletions ncalendar/src/main/java/com/necer/calendar/ICalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ public interface ICalendar {
*/
void jumpDate(String formatDate);

/**
* 跳转日期
*
* @param year
* @param month
* @param day
*/
void jumpDate(int year, int month, int day);

/**
* 跳转日期,跳转到对应月份
*
* @param year
* @param month
*/
void jumpMonth(int year, int month);


/**
* 上一页 上一周 上一月
*/
Expand Down
18 changes: 18 additions & 0 deletions ncalendar/src/main/java/com/necer/calendar/NCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,24 @@ public void jumpDate(String formatDate) {
}
}

@Override
public void jumpDate(int year, int month, int day) {
if (calendarState == CalendarState.WEEK) {
weekCalendar.jumpDate(year, month, day);
} else {
monthCalendar.jumpDate(year, month, day);
}
}

@Override
public void jumpMonth(int year, int month) {
if (calendarState == CalendarState.WEEK) {
weekCalendar.jumpMonth(year, month);
} else {
monthCalendar.jumpMonth(year, month);
}
}

@Override
public void setInitializeDate(String formatDate) {
monthCalendar.setInitializeDate(formatDate);
Expand Down

0 comments on commit beeca2a

Please sign in to comment.