public class State


Represents a full state of a ConstraintLayout

Summary

Nested types

public enum State.Chain
public enum State.Constraint
public enum State.Direction
public enum State.Helper
public enum State.Wrap

Constants

static final Integer

Public fields

final ConstraintReference

Public constructors

Public methods

void
BarrierReference
barrier(Object key, State.Direction direction)
void

Baseline is needed for this object

AlignHorizontallyReference
centerHorizontally(Object[] references)
AlignVerticallyReference
centerVertically(Object[] references)
ConstraintReference
int

Implements a conversion function for values, returning int.

ConstraintReference

Create a new reference given a key.

void
FlowReference
getFlow(Object key, boolean vertical)

Gets a reference to a Flow object.

@NonNull GridReference
getGrid(@NonNull Object key, @NonNull String gridType)

Get a Grid reference

FlowReference

Get a HorizontalFlowReference

FlowReference
getHorizontalFlow(Object[] references)

Get a HorizontalFlowReference and add it to references

ArrayList<String>
FlowReference

Get a VerticalFlowReference

FlowReference
getVerticalFlow(Object[] references)

Get a VerticalFlowReference and add it to references

GuidelineReference
guideline(Object key, int orientation)
State
height(Dimension dimension)
HelperReference
helper(Object key, State.Helper type)
HorizontalChainReference
HorizontalChainReference
horizontalChain(Object[] references)
GuidelineReference
boolean

Does this constraintWidget need a baseline

boolean

This method is deprecated.

For consistency, use isRtl instead.

boolean

Returns true if layout direction is right to left.

void
map(Object key, Object view)
void

Clear the state

boolean
sameFixedHeight(int height)
boolean
sameFixedWidth(int width)
void

Set the function that converts dp to Pixels

State
setHeight(Dimension dimension)
void
setLtr(boolean isLtr)

This method is deprecated.

For consistency, use setRtl instead.

void
setRtl(boolean isRtl)

Set whether the layout direction is right to left (Rtl).

void
setTag(String key, String tag)
State
setWidth(Dimension dimension)
VerticalChainReference
VerticalChainReference
verticalChain(Object[] references)
GuidelineReference
State
width(Dimension dimension)

Constants

PARENT

Added in 1.1.0-alpha13
public static final Integer PARENT

Public fields

mParent

Added in 1.1.0-alpha13
public final ConstraintReference mParent

Protected fields

mHelperReferences

Added in 1.1.0-alpha13
protected HashMap<ObjectHelperReferencemHelperReferences

mReferences

Added in 1.1.0-alpha13
protected HashMap<ObjectReferencemReferences

Public constructors

State

Added in 1.1.0-alpha13
public State()

Public methods

apply

Added in 1.1.0-alpha13
public void apply(ConstraintWidgetContainer container)

barrier

Added in 1.1.0-alpha13
public BarrierReference barrier(Object key, State.Direction direction)

baselineNeededFor

Added in 1.1.0-alpha13
public void baselineNeededFor(Object id)

Baseline is needed for this object

centerHorizontally

public AlignHorizontallyReference centerHorizontally(Object[] references)

centerVertically

public AlignVerticallyReference centerVertically(Object[] references)

constraints

Added in 1.1.0-alpha13
public ConstraintReference constraints(Object key)

convertDimension

Added in 1.1.0-alpha13
public int convertDimension(Object value)

Implements a conversion function for values, returning int. This can be used in case values (e.g. margins) are represented via an object, not directly an int.

Parameters
Object value

the object to convert from

createConstraintReference

Added in 1.1.0-alpha13
public ConstraintReference createConstraintReference(Object key)

Create a new reference given a key.

directMapping

Added in 1.1.0-alpha13
public void directMapping()

getFlow

Added in 1.1.0-alpha13
public FlowReference getFlow(Object key, boolean vertical)

Gets a reference to a Flow object. Creating it if needed.

Parameters
Object key

id of the reference

boolean vertical

is it a vertical or horizontal flow

Returns
FlowReference

a FlowReference

getGrid

Added in 1.1.0-alpha13
public @NonNull GridReference getGrid(@NonNull Object key, @NonNull String gridType)

Get a Grid reference

Parameters
@NonNull Object key

name of the reference object

@NonNull String gridType

type of Grid pattern - Grid, Row, or Column

Returns
@NonNull GridReference

a GridReference object

getHorizontalFlow

Added in 1.1.0-alpha13
public FlowReference getHorizontalFlow()

Get a HorizontalFlowReference

Returns
FlowReference

a HorizontalFlowReference

getHorizontalFlow

public FlowReference getHorizontalFlow(Object[] references)

Get a HorizontalFlowReference and add it to references

Parameters
Object[] references

references where we the HorizontalFlowReference

Returns
FlowReference

a HorizontalFlowReference

getIdsForTag

Added in 1.1.0-alpha13
public ArrayList<StringgetIdsForTag(String tag)

getVerticalFlow

Added in 1.1.0-alpha13
public FlowReference getVerticalFlow()

Get a VerticalFlowReference

Returns
FlowReference

a VerticalFlowReference

getVerticalFlow

public FlowReference getVerticalFlow(Object[] references)

Get a VerticalFlowReference and add it to references

Parameters
Object[] references

where we add the VerticalFlowReference

Returns
FlowReference

a VerticalFlowReference

guideline

Added in 1.1.0-alpha13
public GuidelineReference guideline(Object key, int orientation)

height

Added in 1.1.0-alpha13
public State height(Dimension dimension)

helper

Added in 1.1.0-alpha13
public HelperReference helper(Object key, State.Helper type)

horizontalChain

Added in 1.1.0-alpha13
public HorizontalChainReference horizontalChain()

horizontalChain

public HorizontalChainReference horizontalChain(Object[] references)

horizontalGuideline

Added in 1.1.0-alpha13
public GuidelineReference horizontalGuideline(Object key)

isBaselineNeeded

Added in 1.1.0-alpha13
public boolean isBaselineNeeded(ConstraintWidget constraintWidget)

Does this constraintWidget need a baseline

Returns
boolean

true if the constraintWidget needs a baseline

isLtr

Added in 1.1.0-alpha13
Deprecated in 1.1.0-alpha13
public boolean isLtr()

Returns true if layout direction is left to right. False for right to left.

isRtl

Added in 1.1.0-alpha13
public boolean isRtl()

Returns true if layout direction is right to left. False for left to right.

map

Added in 1.1.0-alpha13
public void map(Object key, Object view)

reset

Added in 1.1.0-alpha13
public void reset()

Clear the state

sameFixedHeight

Added in 1.1.0-alpha13
public boolean sameFixedHeight(int height)

sameFixedWidth

Added in 1.1.0-alpha13
public boolean sameFixedWidth(int width)

setDpToPixel

Added in 1.1.0-alpha13
public void setDpToPixel(CorePixelDp dpToPixel)

Set the function that converts dp to Pixels

setHeight

Added in 1.1.0-alpha13
public State setHeight(Dimension dimension)

setLtr

Added in 1.1.0-alpha13
Deprecated in 1.1.0-alpha13
public void setLtr(boolean isLtr)

Set whether the layout direction is left to right (Ltr).

setRtl

Added in 1.1.0-alpha13
public void setRtl(boolean isRtl)

Set whether the layout direction is right to left (Rtl).

setTag

Added in 1.1.0-alpha13
public void setTag(String key, String tag)

setWidth

Added in 1.1.0-alpha13
public State setWidth(Dimension dimension)

verticalChain

Added in 1.1.0-alpha13
public VerticalChainReference verticalChain()

verticalChain

public VerticalChainReference verticalChain(Object[] references)

verticalGuideline

Added in 1.1.0-alpha13
public GuidelineReference verticalGuideline(Object key)

width

Added in 1.1.0-alpha13
public State width(Dimension dimension)