Stay organized with collections Save and categorize content based on your preferences.

State

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

Returns true if layout direction is left to right.

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)

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

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

Constants

PARENT

public static final Integer PARENT

Public fields

mParent

public final ConstraintReference mParent

Protected fields

mHelperReferences

protected HashMap<ObjectHelperReferencemHelperReferences

mReferences

protected HashMap<ObjectReferencemReferences

Public constructors

State

public State()

Public methods

apply

public void apply(ConstraintWidgetContainer container)

barrier

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

baselineNeededFor

public void baselineNeededFor(Object id)

Baseline is needed for this object

centerHorizontally

public AlignHorizontallyReference centerHorizontally(Object[] references)

centerVertically

public AlignVerticallyReference centerVertically(Object[] references)

constraints

public ConstraintReference constraints(Object key)

convertDimension

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

public ConstraintReference createConstraintReference(Object key)

Create a new reference given a key.

directMapping

public void directMapping()

getFlow

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

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

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

public ArrayList<StringgetIdsForTag(String tag)

getVerticalFlow

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

public GuidelineReference guideline(Object key, int orientation)

height

public State height(Dimension dimension)

helper

public HelperReference helper(Object key, State.Helper type)

horizontalChain

public HorizontalChainReference horizontalChain()

horizontalChain

public HorizontalChainReference horizontalChain(Object[] references)

horizontalGuideline

public GuidelineReference horizontalGuideline(Object key)

isBaselineNeeded

public boolean isBaselineNeeded(ConstraintWidget constraintWidget)

Does this constraintWidget need a baseline

Returns
boolean

true if the constraintWidget needs a baseline

isLtr

public boolean isLtr()

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

map

public void map(Object key, Object view)

reset

public void reset()

Clear the state

sameFixedHeight

public boolean sameFixedHeight(int height)

sameFixedWidth

public boolean sameFixedWidth(int width)

setDpToPixel

public void setDpToPixel(CorePixelDp dpToPixel)

Set the function that converts dp to Pixels

setHeight

public State setHeight(Dimension dimension)

setLtr

public void setLtr(boolean isLtr)

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

setTag

public void setTag(String key, String tag)

setWidth

public State setWidth(Dimension dimension)

verticalChain

public VerticalChainReference verticalChain()

verticalChain

public VerticalChainReference verticalChain(Object[] references)

verticalGuideline

public GuidelineReference verticalGuideline(Object key)

width

public State width(Dimension dimension)