Skip to content

Commit

Permalink
fix where lollipop didn't run native reveal animation
Browse files Browse the repository at this point in the history
fix pre lollipop calling invalidateOutline
  • Loading branch information
ozodrukh committed Jun 5, 2016
1 parent d5bcea3 commit bad790a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
Expand Down Expand Up @@ -61,7 +60,7 @@ public final Map<View, RevealValues> getTargets() {
* in order to use your own custom one
*/
protected boolean hasCustomerRevealAnimator() {
return true;
return false;
}

/**
Expand Down Expand Up @@ -89,7 +88,7 @@ public boolean transform(Canvas canvas, View child) {
return revealData != null && revealData.applyTransformation(canvas, child);
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static final class RevealValues {
public static final class RevealValues {
private static final Paint debugPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

static {
Expand Down Expand Up @@ -180,8 +179,10 @@ boolean applyTransformation(Canvas canvas, View child) {
// trick to applyTransformation animation, when even x & y translations are running
path.addCircle(child.getX() + centerX, child.getY() + centerY, radius, Path.Direction.CW);

child.invalidateOutline();
canvas.clipPath(path, op);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
child.invalidateOutline();
}
return true;
}
}
Expand Down

0 comments on commit bad790a

Please sign in to comment.