Search in sources :

Example 6 with ConstraintWidgetContainer

use of android.support.constraint.solver.widgets.ConstraintWidgetContainer in project android by JetBrains.

the class WidgetDecorator method updateShowAnchorsPolicy.

/**
     * Update the show anchors policy. Used for selected widgets.
     */
private void updateShowAnchorsPolicy() {
    mDisplayAnchorsPolicy.clear();
    mDisplayAnchorsPolicy.add(WidgetDraw.ANCHORS_DISPLAY.ALL);
    mDisplayAnchorsPolicy.add(WidgetDraw.ANCHORS_DISPLAY.SELECTED);
    if (mWidget.getParent() instanceof ConstraintWidgetContainer) {
        ConstraintWidgetContainer container = (ConstraintWidgetContainer) mWidget.getParent();
        if (container.handlesInternalConstraints()) {
            mDisplayAnchorsPolicy.clear();
            mDisplayAnchorsPolicy.add(WidgetDraw.ANCHORS_DISPLAY.NONE);
        }
    } else {
        // if the parent is NOT a ConstraintWidgetContainer, don't show the anchors
        mDisplayAnchorsPolicy.clear();
        mDisplayAnchorsPolicy.add(WidgetDraw.ANCHORS_DISPLAY.NONE);
    }
    if (!mShowResizeHandles) {
        mDisplayAnchorsPolicy.clear();
        mDisplayAnchorsPolicy.add(WidgetDraw.ANCHORS_DISPLAY.CONNECTED);
    }
}
Also used : ConstraintWidgetContainer(android.support.constraint.solver.widgets.ConstraintWidgetContainer)

Aggregations

ConstraintWidgetContainer (android.support.constraint.solver.widgets.ConstraintWidgetContainer)6 ConstraintAnchor (android.support.constraint.solver.widgets.ConstraintAnchor)3 ConstraintWidget (android.support.constraint.solver.widgets.ConstraintWidget)3 Guideline (android.support.constraint.solver.widgets.Guideline)2 ArrayList (java.util.ArrayList)2 ConstraintTableLayout (android.support.constraint.solver.widgets.ConstraintTableLayout)1