diff --git a/library/build.gradle b/library/build.gradle index 1be59f8..50ddc0b 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 26 - versionCode 1 - versionName "1.0" + versionCode 2 + versionName "1.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/library/src/main/java/cn/davidsu/library/CustomShadowBackground.java b/library/src/main/java/cn/davidsu/library/CustomShadowBackground.java index 59cf225..7aed765 100644 --- a/library/src/main/java/cn/davidsu/library/CustomShadowBackground.java +++ b/library/src/main/java/cn/davidsu/library/CustomShadowBackground.java @@ -39,7 +39,7 @@ public class CustomShadowBackground extends Drawable { private int mOffsetY; @Nullable - private RectF mRectF; + private RectF mRectF = new RectF(); @Nullable private Paint mPaint; @@ -62,11 +62,9 @@ protected CustomShadowBackground(@ColorInt int color, @Nullable int[] colorArray @Override public void draw(@NonNull Canvas canvas) { - if (mRectF == null) { - Rect bounds = getBounds(); - mRectF = new RectF(bounds.left + mShadowRadius - mOffsetX, bounds.top + mShadowRadius - mOffsetY, bounds.right - mShadowRadius - mOffsetX, - bounds.bottom - mShadowRadius - mOffsetY); - } + Rect bounds = getBounds(); + mRectF.set(bounds.left + mShadowRadius - mOffsetX, bounds.top + mShadowRadius - mOffsetY, bounds.right - mShadowRadius - mOffsetX, + bounds.bottom - mShadowRadius - mOffsetY); if (mPaint == null) { initPaint();