Skip to content

Commit

Permalink
fix DST bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghaibin-dev committed Apr 21, 2020
1 parent 7184884 commit 9fa0f47
Show file tree
Hide file tree
Showing 28 changed files with 209 additions and 184 deletions.
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file added .idea/caches/gradle_models.ser
Binary file not shown.
109 changes: 109 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ You can't think of the calendar can be so elegant!

<img src="https://github.com/huanghaibin-dev/CalendarView/blob/master/app/src/main/assets/screen_recorder_range.gif" height="650"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="https://github.com/huanghaibin-dev/CalendarView/blob/master/app/src/main/assets/screen_recorder_multi.gif" height="650"/>

### gradle
### AndroidStudio v3.5+

### support version if using support package
```
implementation 'com.haibin:calendarview:3.6.6'
implementation 'com.haibin:calendarview:3.6.8'
```

### Androidx support since version 3.6.5
### Androidx version if using Androidx
```
implementation 'com.haibin:calendarview:3.6.7'
implementation 'com.haibin:calendarview:3.6.9'
```

```
<dependency>
<groupId>com.haibin</groupId>
<artifactId>calendarview</artifactId>
<version>3.6.6</version>
<version>3.6.9</version>
<type>pom</type>
</dependency>
```
Expand Down
10 changes: 6 additions & 4 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ Android上一个优雅、高度自定义、性能高效的日历控件,完美

[**详细介绍**](https://github.com/huanghaibin-dev/CalendarView/blob/master/QUESTION_ZH.md)

### Gradle
### AndroidStudio v3.5+

### support版本使用
```
implementation 'com.haibin:calendarview:3.6.6
implementation 'com.haibin:calendarview:3.6.8
```

### 从3.6.5开始支持Androidx
### Androidx版本使用
```
implementation 'com.haibin:calendarview:3.6.7'
implementation 'com.haibin:calendarview:3.6.9'
```

```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.haibin.calendarviewproject.colorful;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.view.View;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.MonthView;
Expand All @@ -19,14 +17,6 @@ public class ColorfulMonthView extends MonthView {

public ColorfulMonthView(Context context) {
super(context);

//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSelectedPaint);
//4.0以上硬件加速会导致无效
mSelectedPaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));

setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemePaint);
mSchemePaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public class ColorfulWeekView extends WeekView {

public ColorfulWeekView(Context context) {
super(context);
//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSelectedPaint);
//4.0以上硬件加速会导致无效
mSelectedPaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));

setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemePaint);
mSchemePaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));
// //兼容硬件加速无效的代码
// setLayerType(View.LAYER_TYPE_SOFTWARE, mSelectedPaint);
// //4.0以上硬件加速会导致无效
// mSelectedPaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));
//
// setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemePaint);
// mSchemePaint.setMaskFilter(new BlurMaskFilter(30, BlurMaskFilter.Blur.SOLID));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.haibin.calendarviewproject.custom;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextUtils;
import android.view.View;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.MonthView;
Expand Down Expand Up @@ -94,13 +92,6 @@ public CustomMonthView(Context context) {
Paint.FontMetrics metrics = mSchemeBasicPaint.getFontMetrics();
mSchemeBaseLine = mCircleRadius - metrics.descent + (metrics.bottom - metrics.top) / 2 + dipToPx(getContext(), 1);

//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSelectedPaint);
//4.0以上硬件加速会导致无效
mSelectedPaint.setMaskFilter(new BlurMaskFilter(28, BlurMaskFilter.Blur.SOLID));

setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemeBasicPaint);
mSchemeBasicPaint.setMaskFilter(new BlurMaskFilter(28, BlurMaskFilter.Blur.SOLID));

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.haibin.calendarviewproject.custom;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextUtils;
import android.view.View;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.WeekView;
Expand Down Expand Up @@ -96,13 +94,6 @@ public CustomWeekView(Context context) {
Paint.FontMetrics metrics = mSchemeBasicPaint.getFontMetrics();
mSchemeBaseLine = mCircleRadius - metrics.descent + (metrics.bottom - metrics.top) / 2 + dipToPx(getContext(), 1);

//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSelectedPaint);
//4.0以上硬件加速会导致无效
mSelectedPaint.setMaskFilter(new BlurMaskFilter(28, BlurMaskFilter.Blur.SOLID));

setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemeBasicPaint);
mSchemeBasicPaint.setMaskFilter(new BlurMaskFilter(28, BlurMaskFilter.Blur.SOLID));
}


Expand All @@ -121,7 +112,7 @@ protected boolean onDrawSelected(Canvas canvas, Calendar calendar, int x, boolea
return true;
}

@SuppressWarnings("IntegerDivisionInFloatingPointContext")

@Override
protected void onDrawScheme(Canvas canvas, Calendar calendar, int x) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public CustomYearView(Context context) {

}

@SuppressWarnings("IntegerDivisionInFloatingPointContext")
@Override
protected void onDrawMonth(Canvas canvas, int year, int month, int x, int y, int width, int height) {

Expand Down Expand Up @@ -82,7 +81,7 @@ private static boolean isLeapYear(int year) {
}


@SuppressWarnings("IntegerDivisionInFloatingPointContext")

@Override
protected void onDrawWeek(Canvas canvas, int week, int x, int y, int width, int height) {
String text = getContext().getResources().getStringArray(com.haibin.calendarview.R.array.year_view_week_string_array)[week];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.haibin.calendarviewproject.meizu;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.MonthView;
Expand Down Expand Up @@ -46,10 +44,10 @@ public MeiZuMonthView(Context context) {
Paint.FontMetrics metrics = mSchemeBasicPaint.getFontMetrics();
mSchemeBaseLine = mRadio - metrics.descent + (metrics.bottom - metrics.top) / 2 + dipToPx(getContext(), 1);

//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemeBasicPaint);
//4.0以上硬件加速会导致无效
mSchemeBasicPaint.setMaskFilter(new BlurMaskFilter(25, BlurMaskFilter.Blur.SOLID));
// //兼容硬件加速无效的代码
// setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemeBasicPaint);
// //4.0以上硬件加速会导致无效
// mSchemeBasicPaint.setMaskFilter(new BlurMaskFilter(25, BlurMaskFilter.Blur.SOLID));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.haibin.calendarviewproject.meizu;

import android.content.Context;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.WeekView;
Expand Down Expand Up @@ -39,11 +37,6 @@ public MeizuWeekView(Context context) {
mPadding = dipToPx(getContext(), 4);
Paint.FontMetrics metrics = mSchemeBasicPaint.getFontMetrics();
mSchemeBaseLine = mRadio - metrics.descent + (metrics.bottom - metrics.top) / 2 + dipToPx(getContext(), 1);

//兼容硬件加速无效的代码
setLayerType(View.LAYER_TYPE_SOFTWARE, mSchemeBasicPaint);
//4.0以上硬件加速会导致无效
mSchemeBasicPaint.setMaskFilter(new BlurMaskFilter(25, BlurMaskFilter.Blur.SOLID));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ public boolean onCalendarIntercept(Calendar calendar) {
int day = calendar.getDay();
// return day == 1 || day == 3 || day == 6 || day == 11 ||
// day == 12 || day == 15 || day == 20 || day == 26;
return calendar.hasScheme();
// return calendar.hasScheme();
return calendar.getYear()<= mCalendarView.getCurYear() &&
calendar.getMonth() <= mCalendarView.getCurMonth() &&
calendar.getDay() < mCalendarView.getCurDay();
}

@Override
Expand Down
Loading

0 comments on commit 9fa0f47

Please sign in to comment.