Class ConstraintWidgetContainer
- java.lang.Object
-
- androidx.constraintlayout.core.widgets.ConstraintWidget
-
- androidx.constraintlayout.core.widgets.WidgetContainer
-
- androidx.constraintlayout.core.widgets.ConstraintWidgetContainer
-
public class ConstraintWidgetContainer extends WidgetContainer
A container of ConstraintWidget that can layout its children
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class androidx.constraintlayout.core.widgets.ConstraintWidget
ConstraintWidget.DimensionBehaviour
-
-
Field Summary
Fields Modifier and Type Field Description DependencyGraphmDependencyGraphbooleanmGroupsWrapOptimizedintmHorizontalChainsSizebooleanmHorizontalWrapOptimizedBasicMeasure.MeasuremMeasureprotected BasicMeasure.MeasurermMeasurerMetricsmMetricsbooleanmSkipSolverprotected LinearSystemmSystemintmVerticalChainsSizebooleanmVerticalWrapOptimizedintmWrapFixedHeightintmWrapFixedWidth-
Fields inherited from class androidx.constraintlayout.core.widgets.WidgetContainer
mChildren
-
Fields inherited from class androidx.constraintlayout.core.widgets.ConstraintWidget
ANCHOR_BASELINE, ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT, ANCHOR_TOP, BOTH, CHAIN_PACKED, CHAIN_SPREAD, CHAIN_SPREAD_INSIDE, DEFAULT_BIAS, DIRECT, frame, GONE, HORIZONTAL, horizontalChainRun, horizontalGroup, INVISIBLE, isTerminalWidget, mAnchors, MATCH_CONSTRAINT_PERCENT, MATCH_CONSTRAINT_RATIO, MATCH_CONSTRAINT_RATIO_RESOLVED, MATCH_CONSTRAINT_SPREAD, MATCH_CONSTRAINT_WRAP, mBaseline, mBottom, mCenter, mDimensionRatio, mDimensionRatioSide, measured, mHorizontalResolution, mHorizontalRun, mIsHeightWrapContent, mIsWidthWrapContent, mLeft, mListAnchors, mListDimensionBehaviors, mListNextMatchConstraintsWidget, mMatchConstraintDefaultHeight, mMatchConstraintDefaultWidth, mMatchConstraintMaxHeight, mMatchConstraintMaxWidth, mMatchConstraintMinHeight, mMatchConstraintMinWidth, mMatchConstraintPercentHeight, mMatchConstraintPercentWidth, mMinHeight, mMinWidth, mNextChainWidget, mOffsetX, mOffsetY, mParent, mResolvedMatchConstraintDefault, mRight, mTop, mVerticalResolution, mVerticalRun, mWeight, mX, mY, run, SOLVER, stringId, UNKNOWN, VERTICAL, verticalChainRun, verticalGroup, VISIBLE, WRAP_BEHAVIOR_HORIZONTAL_ONLY, WRAP_BEHAVIOR_INCLUDED, WRAP_BEHAVIOR_SKIPPED, WRAP_BEHAVIOR_VERTICAL_ONLY
-
-
Constructor Summary
Constructors Constructor Description ConstraintWidgetContainer()Default constructorConstraintWidgetContainer(int width, int height)ConstructorConstraintWidgetContainer(int x, int y, int width, int height)ConstructorConstraintWidgetContainer(java.lang.String debugName, int width, int height)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddChildrenToSolver(LinearSystem system)Add this widget to the solvervoidaddHorizontalWrapMaxVariable(ConstraintAnchor right)voidaddHorizontalWrapMinVariable(ConstraintAnchor left)voiddefineTerminalWidgets()booleandirectMeasure(boolean optimizeWrap)booleandirectMeasureSetup(boolean optimizeWrap)booleandirectMeasureWithOrientation(boolean optimizeWrap, int orientation)voidfillMetrics(Metrics metrics)java.util.ArrayList<Guideline>getHorizontalGuidelines()Accessor to the horizontal guidelines contained in the table.BasicMeasure.MeasurergetMeasurer()intgetOptimizationLevel()Returns the current optimization levelvoidgetSceneString(java.lang.StringBuilder ret)LinearSystemgetSystem()java.lang.StringgetType()Specify the xml type for the containerjava.util.ArrayList<Guideline>getVerticalGuidelines()Accessor to the vertical guidelines contained in the table.booleanhandlesInternalConstraints()Indicates if the container knows how to layout its content on its ownvoidinvalidateGraph()Invalidate the graph of constraintsvoidinvalidateMeasures()Invalidate the widgets measuresbooleanisHeightMeasuredTooSmall()Return true if the height given is too small for the content laid outbooleanisRtl()Returns the rtl status.booleanisWidthMeasuredTooSmall()Return true if the width given is too small for the content laid outvoidlayout()Layout the tree of widgetslongmeasure(int optimizationLevel, int widthMode, int widthSize, int heightMode, int heightSize, int lastMeasureWidth, int lastMeasureHeight, int paddingX, int paddingY)Measure the layoutstatic booleanmeasure(int level, ConstraintWidget widget, BasicMeasure.Measurer measurer, BasicMeasure.Measure measure, int measureStrategy)booleanoptimizeFor(int feature)Returns true if the given feature should be optimizedvoidreset()voidsetMeasurer(BasicMeasure.Measurer measurer)voidsetOptimizationLevel(int value)Resolves the system directly when possiblevoidsetPadding(int left, int top, int right, int bottom)Set the padding on this container.voidsetPass(int pass)Keep track of the # of passesvoidsetRtl(boolean isRtl)Set the rtl status.booleanupdateChildrenFromSolver(LinearSystem system, boolean[] flags)Update the frame of the layout and its children from the solvervoidupdateFromRuns(boolean updateHorizontal, boolean updateVertical)voidupdateHierarchy()-
Methods inherited from class androidx.constraintlayout.core.widgets.WidgetContainer
add, add, getChildren, getRootConstraintContainer, remove, removeAllChildren, resetSolverVariables, setOffset
-
Methods inherited from class androidx.constraintlayout.core.widgets.ConstraintWidget
addChildrenToSolverByDependency, addToSolver, allowedInBarrier, connect, connect, connect, connectCircularConstraint, copy, createObjectVariables, ensureMeasureRequested, ensureWidgetRuns, getAnchor, getAnchors, getBaselineDistance, getBiasPercent, getBottom, getCompanionWidget, getContainerItemSkip, getDebugName, getDimensionBehaviour, getDimensionRatio, getDimensionRatioSide, getHasBaseline, getHeight, getHorizontalBiasPercent, getHorizontalChainControlWidget, getHorizontalChainStyle, getHorizontalDimensionBehaviour, getHorizontalMargin, getLastHorizontalMeasureSpec, getLastVerticalMeasureSpec, getLeft, getLength, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getNextChainMember, getOptimizerWrapHeight, getOptimizerWrapWidth, getParent, getPreviousChainMember, getRight, getRootX, getRootY, getRun, getTop, getVerticalBiasPercent, getVerticalChainControlWidget, getVerticalChainStyle, getVerticalDimensionBehaviour, getVerticalMargin, getVisibility, getWidth, getWrapBehaviorInParent, getX, getY, hasBaseline, hasDanglingDimension, hasDependencies, hasDimensionOverride, hasResolvedTargets, immediateConnect, isAnimated, isHeightWrapContent, isHorizontalSolvingPassDone, isInBarrier, isInHorizontalChain, isInPlaceholder, isInVerticalChain, isInVirtualLayout, isMeasureRequested, isResolvedHorizontally, isResolvedVertically, isRoot, isSpreadHeight, isSpreadWidth, isVerticalSolvingPassDone, isWidthWrapContent, markHorizontalSolvingPassDone, markVerticalSolvingPassDone, oppositeDimensionDependsOn, oppositeDimensionsTied, resetAllConstraints, resetAnchor, resetAnchors, resetFinalResolution, resetSolvingPassFlag, serialize, setAnimated, setBaselineDistance, setCompanionWidget, setContainerItemSkip, setDebugName, setDebugSolverName, setDimension, setDimensionRatio, setDimensionRatio, setFinalBaseline, setFinalFrame, setFinalHorizontal, setFinalLeft, setFinalTop, setFinalVertical, setFrame, setFrame, setGoneMargin, setHasBaseline, setHeight, setHeightWrapContent, setHorizontalBiasPercent, setHorizontalChainStyle, setHorizontalDimension, setHorizontalDimensionBehaviour, setHorizontalMatchStyle, setHorizontalWeight, setInBarrier, setInPlaceholder, setInVirtualLayout, setLastMeasureSpec, setLength, setMaxHeight, setMaxWidth, setMeasureRequested, setMinHeight, setMinWidth, setOrigin, setParent, setType, setupDimensionRatio, setVerticalBiasPercent, setVerticalChainStyle, setVerticalDimension, setVerticalDimensionBehaviour, setVerticalMatchStyle, setVerticalWeight, setVisibility, setWidth, setWidthWrapContent, setWrapBehaviorInParent, setX, setY, toString, updateFromSolver
-
-
-
-
Field Detail
-
mDependencyGraph
public DependencyGraph mDependencyGraph
-
mMeasurer
protected BasicMeasure.Measurer mMeasurer
-
mMetrics
public Metrics mMetrics
-
mSystem
protected LinearSystem mSystem
-
mHorizontalChainsSize
public int mHorizontalChainsSize
-
mVerticalChainsSize
public int mVerticalChainsSize
-
mGroupsWrapOptimized
public boolean mGroupsWrapOptimized
-
mHorizontalWrapOptimized
public boolean mHorizontalWrapOptimized
-
mVerticalWrapOptimized
public boolean mVerticalWrapOptimized
-
mWrapFixedWidth
public int mWrapFixedWidth
-
mWrapFixedHeight
public int mWrapFixedHeight
-
mSkipSolver
public boolean mSkipSolver
-
mMeasure
public BasicMeasure.Measure mMeasure
-
-
Constructor Detail
-
ConstraintWidgetContainer
public ConstraintWidgetContainer()
Default constructor
-
ConstraintWidgetContainer
public ConstraintWidgetContainer(int x, int y, int width, int height)Constructor- Parameters:
x- x positiony- y positionwidth- width of the layoutheight- height of the layout
-
ConstraintWidgetContainer
public ConstraintWidgetContainer(int width, int height)Constructor- Parameters:
width- width of the layoutheight- height of the layout
-
ConstraintWidgetContainer
public ConstraintWidgetContainer(java.lang.String debugName, int width, int height)
-
-
Method Detail
-
invalidateGraph
public void invalidateGraph()
Invalidate the graph of constraints
-
invalidateMeasures
public void invalidateMeasures()
Invalidate the widgets measures
-
directMeasure
public boolean directMeasure(boolean optimizeWrap)
-
directMeasureSetup
public boolean directMeasureSetup(boolean optimizeWrap)
-
directMeasureWithOrientation
public boolean directMeasureWithOrientation(boolean optimizeWrap, int orientation)
-
defineTerminalWidgets
public void defineTerminalWidgets()
-
measure
public long measure(int optimizationLevel, int widthMode, int widthSize, int heightMode, int heightSize, int lastMeasureWidth, int lastMeasureHeight, int paddingX, int paddingY)Measure the layout
-
updateHierarchy
public void updateHierarchy()
-
setMeasurer
public void setMeasurer(BasicMeasure.Measurer measurer)
-
getMeasurer
public BasicMeasure.Measurer getMeasurer()
-
fillMetrics
public void fillMetrics(Metrics metrics)
-
setOptimizationLevel
public void setOptimizationLevel(int value)
Resolves the system directly when possible- Parameters:
value- optimization level
-
getOptimizationLevel
public int getOptimizationLevel()
Returns the current optimization level
-
optimizeFor
public boolean optimizeFor(int feature)
Returns true if the given feature should be optimized
-
getType
public java.lang.String getType()
Specify the xml type for the container- Overrides:
getTypein classConstraintWidget- Returns:
- type (null if not set)
-
reset
public void reset()
- Overrides:
resetin classWidgetContainer
-
isWidthMeasuredTooSmall
public boolean isWidthMeasuredTooSmall()
Return true if the width given is too small for the content laid out
-
isHeightMeasuredTooSmall
public boolean isHeightMeasuredTooSmall()
Return true if the height given is too small for the content laid out
-
addHorizontalWrapMinVariable
public void addHorizontalWrapMinVariable(ConstraintAnchor left)
-
addHorizontalWrapMaxVariable
public void addHorizontalWrapMaxVariable(ConstraintAnchor right)
-
addChildrenToSolver
public boolean addChildrenToSolver(LinearSystem system)
Add this widget to the solver- Parameters:
system- the solver we want to add the widget to
-
updateChildrenFromSolver
public boolean updateChildrenFromSolver(LinearSystem system, boolean[] flags)
Update the frame of the layout and its children from the solver- Parameters:
system- the solver we get the values from.
-
updateFromRuns
public void updateFromRuns(boolean updateHorizontal, boolean updateVertical)- Overrides:
updateFromRunsin classConstraintWidget
-
setPadding
public void setPadding(int left, int top, int right, int bottom)Set the padding on this container. It will apply to the position of the children.- Parameters:
left- left paddingtop- top paddingright- right paddingbottom- bottom padding
-
setRtl
public void setRtl(boolean isRtl)
Set the rtl status. This has implications for Chains.- Parameters:
isRtl- true if we are in RTL.
-
isRtl
public boolean isRtl()
Returns the rtl status.- Returns:
- true if in RTL, false otherwise.
-
measure
public static boolean measure(int level, ConstraintWidget widget, BasicMeasure.Measurer measurer, BasicMeasure.Measure measure, int measureStrategy)
-
layout
public void layout()
Layout the tree of widgets- Overrides:
layoutin classWidgetContainer
-
handlesInternalConstraints
public boolean handlesInternalConstraints()
Indicates if the container knows how to layout its content on its own- Returns:
- true if the container does the layout, false otherwise
-
getVerticalGuidelines
public java.util.ArrayList<Guideline> getVerticalGuidelines()
Accessor to the vertical guidelines contained in the table.- Returns:
- array of guidelines
-
getHorizontalGuidelines
public java.util.ArrayList<Guideline> getHorizontalGuidelines()
Accessor to the horizontal guidelines contained in the table.- Returns:
- array of guidelines
-
getSystem
public LinearSystem getSystem()
-
setPass
public void setPass(int pass)
Keep track of the # of passes
-
getSceneString
public void getSceneString(java.lang.StringBuilder ret)
- Overrides:
getSceneStringin classConstraintWidget
-
-