Skip to content

Commit

Permalink
3.0.3版本开源、修复周视图小bug,新增自定义周栏功能,代码整理,官方规范化
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghaibin-dev committed Dec 1, 2017
1 parent 37833f2 commit 990024c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Android上一个优雅、高度自定义、性能高效的日历控件,完美

### Gradle
```
compile 'com.haibin:calendarview:3.0.2'
compile 'com.haibin:calendarview:3.0.3'
```
```
<dependency>
<groupId>com.haibin</groupId>
<artifactId>calendarview</artifactId>
<version>3.0.2</version>
<version>3.0.3</version>
<type>pom</type>
</dependency>
```
Expand Down
4 changes: 2 additions & 2 deletions calendarview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdkVersion 15
//noinspection OldTargetApi
targetSdkVersion 23
versionCode 302
versionName "3.0.2"
versionCode 303
versionName "3.0.3"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private void init() {
mCurrentDate.setYear(Util.getDate("yyyy", d));
mCurrentDate.setMonth(Util.getDate("MM", d));
mCurrentDate.setDay(Util.getDate("dd", d));
mCurrentDate.setLunar(LunarCalendar.getLunarText(mCurrentDate));
}

int getCurDayTextColor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ class LunarCalendar {

/**
* 返回传统农历节日
* @param year 农历年
*
* @param year 农历年
* @param month 农历月
* @param day 农历日
* @param day 农历日
* @return 返回传统农历节日
*/
private static String getTraditionFestivalText(int year,int month,int day){
if(month == 12){
private static String getTraditionFestivalText(int year, int month, int day) {
if (month == 12) {
int count = daysInLunarMonth(year, month);
if(day == count){
if (day == count) {
return TRADITION_FESTIVAL_STR[0];//除夕
}
}
Expand Down Expand Up @@ -543,7 +544,6 @@ private static int getWinterSolstice(int year) {
}



/**
* 获取农历节日
*
Expand All @@ -560,11 +560,19 @@ static String getLunarText(int year, int month, int day) {
if (!TextUtils.isEmpty(termText))
return termText;
int[] lunar = LunarCalendar.solarToLunar(year, month, day);
String festival = getTraditionFestivalText(lunar[0],lunar[1],lunar[2]);
String festival = getTraditionFestivalText(lunar[0], lunar[1], lunar[2]);
if (!TextUtils.isEmpty(festival))
return festival;
return LunarCalendar.numToChinese(lunar[1], lunar[2]);
}


/**
* 获取农历节日
* @param calendar calendar
* @return 获取农历节日
*/
static String getLunarText(Calendar calendar) {
return getLunarText(calendar.getYear(), calendar.getMonth(), calendar.getDay());
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ org.gradle.jvmargs=-Xmx1536m
POM_BINTRAY_NAME=com.haibin:calendarview
POM_DESCRIPTION=A very good CalendarView for Android.
POM_ARTIFACT_ID=calendarview
VERSION_NAME=3.0.2
VERSION_CODE=3.0.2
VERSION_NAME=3.0.3
VERSION_CODE=3.0.3
POM_BINTRAY_PRPO=maven
POM_PACKAGING=aar
POM_NAME=calendarview
Expand Down

0 comments on commit 990024c

Please sign in to comment.