Loading graphics/java/android/graphics/drawable/RippleComponent.java +14 −3 Original line number Diff line number Diff line Loading @@ -57,14 +57,19 @@ abstract class RippleComponent { mBounds = bounds; } public void onBoundsChange() { if (!mHasMaxRadius) { mTargetRadius = getTargetRadius(mBounds); onTargetRadiusChanged(mTargetRadius); } } public final void setup(float maxRadius, float density) { if (maxRadius >= 0) { mHasMaxRadius = true; mTargetRadius = maxRadius; } else { final float halfWidth = mBounds.width() / 2.0f; final float halfHeight = mBounds.height() / 2.0f; mTargetRadius = (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight); mTargetRadius = getTargetRadius(mBounds); } mDensity = density; Loading @@ -72,6 +77,12 @@ abstract class RippleComponent { onTargetRadiusChanged(mTargetRadius); } private static float getTargetRadius(Rect bounds) { final float halfWidth = bounds.width() / 2.0f; final float halfHeight = bounds.height() / 2.0f; return (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight); } /** * Starts a ripple enter animation. * Loading graphics/java/android/graphics/drawable/RippleDrawable.java +8 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; Loading Loading @@ -294,6 +293,14 @@ public class RippleDrawable extends LayerDrawable { onHotspotBoundsChanged(); } if (mBackground != null) { mBackground.onBoundsChange(); } if (mRipple != null) { mRipple.onBoundsChange(); } invalidateSelf(); } Loading Loading
graphics/java/android/graphics/drawable/RippleComponent.java +14 −3 Original line number Diff line number Diff line Loading @@ -57,14 +57,19 @@ abstract class RippleComponent { mBounds = bounds; } public void onBoundsChange() { if (!mHasMaxRadius) { mTargetRadius = getTargetRadius(mBounds); onTargetRadiusChanged(mTargetRadius); } } public final void setup(float maxRadius, float density) { if (maxRadius >= 0) { mHasMaxRadius = true; mTargetRadius = maxRadius; } else { final float halfWidth = mBounds.width() / 2.0f; final float halfHeight = mBounds.height() / 2.0f; mTargetRadius = (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight); mTargetRadius = getTargetRadius(mBounds); } mDensity = density; Loading @@ -72,6 +77,12 @@ abstract class RippleComponent { onTargetRadiusChanged(mTargetRadius); } private static float getTargetRadius(Rect bounds) { final float halfWidth = bounds.width() / 2.0f; final float halfHeight = bounds.height() / 2.0f; return (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight); } /** * Starts a ripple enter animation. * Loading
graphics/java/android/graphics/drawable/RippleDrawable.java +8 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; Loading Loading @@ -294,6 +293,14 @@ public class RippleDrawable extends LayerDrawable { onHotspotBoundsChanged(); } if (mBackground != null) { mBackground.onBoundsChange(); } if (mRipple != null) { mRipple.onBoundsChange(); } invalidateSelf(); } Loading