use of android.animation.RectEvaluator in project android_frameworks_base by DirtyUnicorns.
the class ChangeClipBounds method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues == null || endValues == null || !startValues.values.containsKey(PROPNAME_CLIP) || !endValues.values.containsKey(PROPNAME_CLIP)) {
return null;
}
Rect start = (Rect) startValues.values.get(PROPNAME_CLIP);
Rect end = (Rect) endValues.values.get(PROPNAME_CLIP);
if (start == null && end == null) {
// No animation required since there is no clip.
return null;
}
if (start == null) {
start = (Rect) startValues.values.get(PROPNAME_BOUNDS);
} else if (end == null) {
end = (Rect) endValues.values.get(PROPNAME_BOUNDS);
}
if (start.equals(end)) {
return null;
}
endValues.view.setClipBounds(start);
RectEvaluator evaluator = new RectEvaluator(new Rect());
return ObjectAnimator.ofObject(endValues.view, "clipBounds", evaluator, start, end);
}
Aggregations