use of com.android.tools.sherpa.animation.AnimatedLine in project android by JetBrains.
the class SceneDraw method animateInCandidateAnchors.
/**
* Utility function. Given the currently selected anchor, gather all the
* potential anchors that we could connect to and start an AnimatedCircle animation
* where they are, to indicate them to the user.
*/
private void animateInCandidateAnchors(ConstraintAnchor selectedAnchor) {
if (selectedAnchor == null) {
return;
}
mAnimationCandidateAnchors.clear();
for (ConstraintWidget widget : mWidgetsScene.getWidgets()) {
boolean highlighted = false;
for (ConstraintAnchor a : widget.getAnchors()) {
if (selectedAnchor.isValidConnection(a) && selectedAnchor.isConnectionAllowed(a.getOwner(), a)) {
ConstraintHandle constraintHandle = WidgetInteractionTargets.constraintHandle(a);
if (constraintHandle == null) {
continue;
}
mAnimationCandidateAnchors.add(new AnimatedLine(constraintHandle));
highlighted = true;
}
}
WidgetCompanion companion = (WidgetCompanion) widget.getCompanionWidget();
WidgetDecorator decorator = companion.getWidgetDecorator(getCurrentStyle());
if (decorator.getLook() == ColorTheme.Look.NORMAL) {
if (highlighted) {
decorator.setLook(ColorTheme.Look.HIGHLIGHTED);
} else {
decorator.setLook(ColorTheme.Look.SUBDUED);
}
}
}
mChoreographer.addAnimation(mAnimationCandidateAnchors);
}
Aggregations