Fixed EdgeEffect drawn on non-RecordingCanvas
Fixes: 183079166 When the EdgeEffect was drawn on a non-RecordingCanvas, the animation was never completed when using TYPE_STRETCH. Because TYPE_STRETCH can only be applied to RecordingCanvas, the animation ends immediately when drawn on a non-RecordingCanvas. Test: manual, I53d59a3b3cd14be658d899ff41c1fa4b83a98a32 Change-Id: I29c04ff7e0aa3269c1b4e9e503dfa641195820a8
This commit is contained in:
@@ -640,6 +640,12 @@ public class EdgeEffect {
|
||||
mWidth,
|
||||
mHeight
|
||||
);
|
||||
} else {
|
||||
// This is TYPE_STRETCH and drawing into a Canvas that isn't a Recording Canvas,
|
||||
// so no effect can be shown. Just end the effect.
|
||||
mState = STATE_IDLE;
|
||||
mDistance = 0;
|
||||
mVelocity = 0;
|
||||
}
|
||||
|
||||
boolean oneLastFrame = false;
|
||||
@@ -771,8 +777,9 @@ public class EdgeEffect {
|
||||
* considered at rest or false if it is still animating.
|
||||
*/
|
||||
private boolean isAtEquilibrium() {
|
||||
double displacement = mDistance * mHeight; // in pixels
|
||||
return Math.abs(mVelocity) < VELOCITY_THRESHOLD
|
||||
double displacement = mDistance * mHeight * LINEAR_STRETCH_INTENSITY; // in pixels
|
||||
double velocity = mVelocity * LINEAR_STRETCH_INTENSITY;
|
||||
return Math.abs(velocity) < VELOCITY_THRESHOLD
|
||||
&& Math.abs(displacement) < VALUE_THRESHOLD;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user