public class StateSet extends Object
View
(e.g. focused,
selected, visible, etc.). A View
may be in
one or more of those states.
A state spec is an array of signed ints where each element
represents a required (if positive) or an undesired (if negative)
View
state.
Utils dealing with state sets.
In theory we could encapsulate the state set and state spec arrays
and not have static methods here but there is some concern about
performance since these methods are called during view drawing.Modifier and Type | Field and Description |
---|---|
static int[] |
NOTHING
A state set that does not contain any valid states.
|
static int |
VIEW_STATE_ACCELERATED |
static int |
VIEW_STATE_ACTIVATED |
static int |
VIEW_STATE_DRAG_CAN_ACCEPT |
static int |
VIEW_STATE_DRAG_HOVERED |
static int |
VIEW_STATE_ENABLED |
static int |
VIEW_STATE_FOCUSED |
static int |
VIEW_STATE_HOVERED |
static int |
VIEW_STATE_PRESSED |
static int |
VIEW_STATE_SELECTED |
static int |
VIEW_STATE_WINDOW_FOCUSED |
static int[] |
WILD_CARD
A state specification that will be matched by all StateSets.
|
Constructor and Description |
---|
StateSet() |
Modifier and Type | Method and Description |
---|---|
static String |
dump(int[] states) |
static int[] |
get(int mask) |
static boolean |
isWildCard(int[] stateSetOrSpec)
Return whether the stateSetOrSpec is matched by all StateSets.
|
static boolean |
stateSetMatches(int[] stateSpec,
int state)
Return whether the state matches the desired stateSpec.
|
static boolean |
stateSetMatches(int[] stateSpec,
int[] stateSet)
Return whether the stateSet matches the desired stateSpec.
|
static int[] |
trimStateSet(int[] states,
int newSize) |
public static final int VIEW_STATE_WINDOW_FOCUSED
public static final int VIEW_STATE_SELECTED
public static final int VIEW_STATE_FOCUSED
public static final int VIEW_STATE_ENABLED
public static final int VIEW_STATE_PRESSED
public static final int VIEW_STATE_ACTIVATED
public static final int VIEW_STATE_ACCELERATED
public static final int VIEW_STATE_HOVERED
public static final int VIEW_STATE_DRAG_CAN_ACCEPT
public static final int VIEW_STATE_DRAG_HOVERED
public static final int[] WILD_CARD
public static final int[] NOTHING
public static int[] get(int mask)
public static boolean isWildCard(int[] stateSetOrSpec)
stateSetOrSpec
- a state set or state spec.public static boolean stateSetMatches(int[] stateSpec, int[] stateSet)
public static boolean stateSetMatches(int[] stateSpec, int state)
public static int[] trimStateSet(int[] states, int newSize)
public static String dump(int[] states)