Merge "Ripple radius bug" into sc-dev
This commit is contained in:
@@ -180,6 +180,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
private Matrix mMaskMatrix;
|
private Matrix mMaskMatrix;
|
||||||
private PorterDuffColorFilter mMaskColorFilter;
|
private PorterDuffColorFilter mMaskColorFilter;
|
||||||
private boolean mHasValidMask;
|
private boolean mHasValidMask;
|
||||||
|
private int mComputedRadius = -1;
|
||||||
|
|
||||||
/** The current ripple. May be actively animating or pending entry. */
|
/** The current ripple. May be actively animating or pending entry. */
|
||||||
private RippleForeground mRipple;
|
private RippleForeground mRipple;
|
||||||
@@ -385,9 +386,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
mRipple.onBoundsChange();
|
mRipple.onBoundsChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
mState.mMaxRadius = mState.mMaxRadius <= 0 && mState.mRippleStyle != STYLE_SOLID
|
mComputedRadius = Math.round(computeRadius());
|
||||||
? (int) computeRadius()
|
|
||||||
: mState.mMaxRadius;
|
|
||||||
invalidateSelf();
|
invalidateSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,7 +917,7 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
ColorFilter origFilter = p.getColorFilter();
|
ColorFilter origFilter = p.getColorFilter();
|
||||||
p.setColorFilter(mMaskColorFilter);
|
p.setColorFilter(mMaskColorFilter);
|
||||||
p.setAlpha(alpha);
|
p.setAlpha(alpha);
|
||||||
c.drawCircle(cx, cy, mState.mMaxRadius, p);
|
c.drawCircle(cx, cy, getComputedRadius(), p);
|
||||||
p.setAlpha(origAlpha);
|
p.setAlpha(origAlpha);
|
||||||
p.setColorFilter(origFilter);
|
p.setColorFilter(origFilter);
|
||||||
}
|
}
|
||||||
@@ -930,11 +929,17 @@ public class RippleDrawable extends LayerDrawable {
|
|||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getComputedRadius() {
|
||||||
|
if (mState.mMaxRadius >= 0) return mState.mMaxRadius;
|
||||||
|
if (mComputedRadius >= 0) return mComputedRadius;
|
||||||
|
return (int) computeRadius();
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private RippleAnimationSession.AnimationProperties<Float, Paint> createAnimationProperties(
|
private RippleAnimationSession.AnimationProperties<Float, Paint> createAnimationProperties(
|
||||||
float x, float y, float cx, float cy, float w, float h) {
|
float x, float y, float cx, float cy, float w, float h) {
|
||||||
Paint p = new Paint(mRipplePaint);
|
Paint p = new Paint(mRipplePaint);
|
||||||
float radius = mState.mMaxRadius;
|
float radius = getComputedRadius();
|
||||||
RippleAnimationSession.AnimationProperties<Float, Paint> properties;
|
RippleAnimationSession.AnimationProperties<Float, Paint> properties;
|
||||||
RippleShader shader = new RippleShader();
|
RippleShader shader = new RippleShader();
|
||||||
int color = mMaskColorFilter == null
|
int color = mMaskColorFilter == null
|
||||||
|
|||||||
Reference in New Issue
Block a user