Class InteractionRule¶
- java.lang.Object
-
- com.iristick.smartglass.core.InteractionRule
@Deprecated public abstract class InteractionRule extends Object
Matching criteria determine on which views the configuration options are to be applied. There are two types of matching criteria:
- Exact view ID: matches the resource ID of a view exactly;
- Regular expression: matches the fully qualified resource name of a view to a regular expression.
Resources.getResourceName(int)
. It includes the package name and
the resource type.
An ordered list of rules can be given to
IristickBinding.setInteractionRules()
to configure the interaction behavior for this application. For each view in this application,
the list of rules will be processed from first to last. Configuration options set on matching
rules will be applied to the view, with options from later rules overriding options from earlier
ones.
For example, the list of rules created by the following code:
List<InteractionRule> rules = new ArrayList<InteractionRule>(); rules.add(InteractionRule.create() .match(R.id.id_a) .set(InteractionRule.FOCUSABLE, InteractionRule.FOCUSABLE_FOCUSABLE) .set(InteractionRule.SCROLL, InteractionRule.SCROLL_RESET_FOCUS)); rules.add(InteractionRule.create() .match(R.id.id_a) .match(R.id.id_b) .set(InteractionRule.NAVIGATION, InteractionRule.NAVIGATION_CYCLIC)); rules.add(InteractionRule.create() .match(".*:id/id_[a-c]") .set(InteractionRule.SCROLL, InteractionRule.SCROLL_DEFAULT)); rules.add(InteractionRule.create() .match(R.id.id_b) .set(InteractionRule.NAVIGATION, InteractionRule.NAVIGATION_NON_CYCLIC) .set(InteractionRule.SCROLL, InteractionRule.SCROLL_PAGED));will result in the following combined options, where empty cells mean the field is unset:
key\view | R.id_a | R.id_b | R.id_c |
---|---|---|---|
FOCUSABLE | FOCUSABLE | ||
NAVIGATION | CYCLIC | NON_CYCLIC | |
SCROLL | DEFAULT | PAGED | DEFAULT |
Objects of this class are created with the create()
factory method.
Nested Class Summary¶
Modifier and Type | Class and Description |
---|---|
static class |
InteractionRule.Key<T>
Deprecated.
|
Field Summary¶
Modifier and Type | Field and Description |
---|---|
static InteractionRule.Key<Integer> |
FOCUSABLE
Deprecated.
Determines whether matching views are focusable.
|
static int |
FOCUSABLE_DEFAULT
Deprecated.
Value for
FOCUSABLE requesting default focus behavior. |
static int |
FOCUSABLE_FOCUSABLE
Deprecated.
Value for
FOCUSABLE requesting that matching views must be focusable. |
static int |
FOCUSABLE_NOT_FOCUSABLE
Deprecated.
Value for
FOCUSABLE requesting that matching views shall not be focusable. |
static int |
HIGHLIGHT_COLOR_DEFAULT
Deprecated.
Value for
HIGHLIGHT_*_COLOR_* requesting the default color. |
static int |
HIGHLIGHT_COLOR_NONE
Deprecated.
Value for
HIGHLIGHT_*_COLOR_* requesting not to draw the specified stroke or fill. |
static InteractionRule.Key<Integer> |
HIGHLIGHT_FILL_COLOR_PRIMARY
Deprecated.
The primary fill color of the highlight, encoded as 0xaarrggbb.
|
static InteractionRule.Key<Integer> |
HIGHLIGHT_FILL_COLOR_SECONDARY
Deprecated.
The secondary fill color of the highlight, encoded as 0xaarrggbb.
|
static InteractionRule.Key<Integer> |
HIGHLIGHT_STROKE_COLOR_PRIMARY
Deprecated.
The primary stroke color of the highlight, encoded as 0xaarrggbb.
|
static InteractionRule.Key<Integer> |
HIGHLIGHT_STROKE_COLOR_SECONDARY
Deprecated.
The secondary stroke color of the highlight, encoded as 0xaarrggbb.
|
static InteractionRule.Key<Float> |
HIGHLIGHT_STROKE_WIDTH
Deprecated.
The stroke width in pixels of the highlight in pixels.
|
static float |
HIGHLIGHT_STROKE_WIDTH_DEFAULT
Deprecated.
Value for
HIGHLIGHT_STROKE_WIDTH requesting the default stroke width. |
static float |
HIGHLIGHT_STROKE_WIDTH_NONE
Deprecated.
Value for
HIGHLIGHT_STROKE_WIDTH requesting no stroke is drawn. |
static InteractionRule.Key<Integer> |
HIGHLIGHT_STYLE
Deprecated.
Overall style of the interaction highlight.
|
static int |
HIGHLIGHT_STYLE_BRIGHT_DARK
Deprecated.
Value for
HIGHLIGHT_STYLE requesting a rounded rectangle with a two-color stroke for
the highlight. |
static int |
HIGHLIGHT_STYLE_DARK_BRIGHT
Deprecated.
Value for
HIGHLIGHT_STYLE requesting a rounded rectangle with a two-color stroke for
the highlight. |
static int |
HIGHLIGHT_STYLE_DEFAULT
Deprecated.
Value for
HIGHLIGHT_STYLE requesting the default highlight style. |
static int |
HIGHLIGHT_STYLE_SINGLE_COLOR
Deprecated.
Value for
HIGHLIGHT_STYLE requesting a rounded rectangle with a single-color stroke
for the highlight. |
static InteractionRule.Key<Integer> |
KEYBOARD
Deprecated.
Behavior when tapping on an editable text view.
|
static int |
KEYBOARD_DEFAULT
Deprecated.
Value for
KEYBOARD letting Iristick Services decide what to do. |
static int |
KEYBOARD_DISABLED
Deprecated.
Value for
KEYBOARD requesting that no custom keyboard is shown. |
static InteractionRule.Key<Integer> |
KEYBOARD_VOICE
Deprecated.
Voice control behavior for the keyboard.
|
static int |
KEYBOARD_VOICE_DEFAULT
Deprecated.
Value for
KEYBOARD_VOICE letting Iristick Services decide what to do. |
static int |
KEYBOARD_VOICE_NO_INHIBIT
Deprecated.
Value for
KEYBOARD_VOICE requesting not to inhibit the other voice commands when
the keyboard is shown for the matched view. |
static InteractionRule.Key<Integer> |
NAVIGATION
Deprecated.
Determines how to navigate between the children of matching views.
|
static int |
NAVIGATION_CYCLIC
Deprecated.
Value for
NAVIGATION requesting to cyclically navigate through all children. |
static int |
NAVIGATION_DEFAULT
Deprecated.
Value for
NAVIGATION letting Iristick Services decide which navigation strategy
to apply. |
static int |
NAVIGATION_DISABLED
Deprecated.
Value for
NAVIGATION requesting to ignore all children. |
static int |
NAVIGATION_NONCYCLIC
Deprecated.
Value for
NAVIGATION requesting to non-cyclically navigate through all children. |
static int |
NAVIGATION_NONCYCLIC_EXIT_BACKWARD
Deprecated.
Value for
NAVIGATION requesting to go up one level when navigating beyond the first
child. |
static int |
NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL
Deprecated.
Value for
NAVIGATION requesting to go up one level when navigating beyond the first
or last child. |
static int |
NAVIGATION_NONCYCLIC_EXIT_FORWARD
Deprecated.
Value for
NAVIGATION requesting to go up one level when navigating beyond the last
child. |
static InteractionRule.Key<Integer> |
SCROLL
Deprecated.
Behavior of scrollable containers, whose children are not all visible.
|
static int |
SCROLL_DEFAULT
Deprecated.
Value for
SCROLL letting Iristick Services decide which strategy to apply. |
static int |
SCROLL_NAVIGATION
Deprecated.
Value for
SCROLL requesting to scroll the container while navigating through its
children. |
static int |
SCROLL_PAGED
Deprecated.
Value for
SCROLL requesting to first scroll the container before navigating through
its children. |
static int |
SCROLL_RESET_FOCUS
Deprecated.
Value for
SCROLL requesting to reset focus every time the container scrolls. |
Constructor Summary¶
Constructor and Description |
---|
InteractionRule()
Deprecated.
|
Method Summary¶
Modifier and Type | Method and Description |
---|---|
abstract boolean |
containsKey(InteractionRule.Key<?> key)
Deprecated.
Determines whether this rule has a value set for the given
key . |
abstract InteractionRule |
copy()
Deprecated.
Creates and returns a copy of this object.
|
static InteractionRule |
create()
Deprecated.
Creates a new interaction rule object.
|
abstract <T> T |
get(InteractionRule.Key<T> key)
Deprecated.
Gets a configuration field value.
|
abstract List<InteractionRule.Key<?>> |
getKeys()
Deprecated.
Return a list of the configuration keys contained in this rule.
|
abstract InteractionRule |
match(Context context,
int id)
Deprecated.
Match views with this specific view ID.
|
abstract InteractionRule |
match(String regex)
Deprecated.
Match views whose fully qualified resource names match the given regular expression.
|
InteractionRule |
match(View view)
Deprecated.
Match the given view by its resource ID.
|
abstract <T> InteractionRule |
set(InteractionRule.Key<T> key,
T value)
Deprecated.
Sets an interaction configuration field value for the given
key . |
Methods inherited from class java.lang.Object¶
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail¶
FOCUSABLE¶
public static final InteractionRule.Key<Integer> FOCUSABLE
FOCUSABLE_DEFAULT¶
public static final int FOCUSABLE_DEFAULT
FOCUSABLE
requesting default focus behavior.
Take into account the importance for accessibility
flag when determining whether matching views should be focusable.
- See Also:
FOCUSABLE
FOCUSABLE_NOT_FOCUSABLE¶
public static final int FOCUSABLE_NOT_FOCUSABLE
FOCUSABLE
requesting that matching views shall not be focusable.
The importance for accessibility
flag is
ignored for matching views.
- See Also:
FOCUSABLE
FOCUSABLE_FOCUSABLE¶
public static final int FOCUSABLE_FOCUSABLE
FOCUSABLE
requesting that matching views must be focusable.
The importance for accessibility
flag is
ignored for matching views.
- See Also:
FOCUSABLE
NAVIGATION¶
public static final InteractionRule.Key<Integer> NAVIGATION
- See Also:
NAVIGATION_DEFAULT
,NAVIGATION_DISABLED
,NAVIGATION_CYCLIC
,NAVIGATION_NONCYCLIC
,NAVIGATION_NONCYCLIC_EXIT_FORWARD
,NAVIGATION_NONCYCLIC_EXIT_BACKWARD
,NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL
NAVIGATION_DEFAULT¶
public static final int NAVIGATION_DEFAULT
NAVIGATION
letting Iristick Services decide which navigation strategy
to apply.- See Also:
NAVIGATION
NAVIGATION_DISABLED¶
public static final int NAVIGATION_DISABLED
NAVIGATION
requesting to ignore all children.
Children of matching views will not be navigated through.
This is similar to setting FOCUSABLE_NOT_FOCUSABLE
for all descendant view of the
matching view.
- See Also:
NAVIGATION
NAVIGATION_CYCLIC¶
public static final int NAVIGATION_CYCLIC
NAVIGATION
requesting to cyclically navigate through all children.
When the first child is selected and the user swipes backward, the focus is shifted to the last child. Similarly, when the last child is selected and the user swipes forward, the focus is shifted to the first child.
Scrollable widgets like ScrollView
and
ListView
will scroll accordingly.
- See Also:
NAVIGATION
NAVIGATION_NONCYCLIC¶
public static final int NAVIGATION_NONCYCLIC
NAVIGATION
requesting to non-cyclically navigate through all children.
When the first child is selected and the user swipes backward, nothing happens and the focus will still be on the first child. Similarly, when the last child is selected and the user swipes forward, the focus stays on the last child.
- See Also:
NAVIGATION
NAVIGATION_NONCYCLIC_EXIT_FORWARD¶
public static final int NAVIGATION_NONCYCLIC_EXIT_FORWARD
NAVIGATION
requesting to go up one level when navigating beyond the last
child.
When the last child is selected and the user swipes forward, the focus will go up one level, to the next sibling of the parent view.
Unlike NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL
, swiping backwards with the
focus on the first child does nothing.
- See Also:
NAVIGATION
NAVIGATION_NONCYCLIC_EXIT_BACKWARD¶
public static final int NAVIGATION_NONCYCLIC_EXIT_BACKWARD
NAVIGATION
requesting to go up one level when navigating beyond the first
child.
When the first child is selected and the user swipes backwards, the focus will go up one level, to the previous sibling of the parent view.
Unlike NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL
, swiping forward with the
focus on the last child does nothing.
- See Also:
NAVIGATION
NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL¶
public static final int NAVIGATION_NONCYCLIC_EXIT_BIDIRECTIONAL
NAVIGATION
requesting to go up one level when navigating beyond the first
or last child.
This option acts as a combination of NAVIGATION_NONCYCLIC_EXIT_FORWARD
and
NAVIGATION_NONCYCLIC_EXIT_BACKWARD
. When the last child is selected and the user
swipes forward, the focus will go up one level, to the next sibling of the parent view.
When the first child is selected and the user swipes backwards, the focus will go up one
level, to the previous sibling of the parent view.
- See Also:
NAVIGATION
SCROLL¶
public static final InteractionRule.Key<Integer> SCROLL
- See Also:
SCROLL_DEFAULT
,SCROLL_NAVIGATION
,SCROLL_PAGED
,SCROLL_RESET_FOCUS
SCROLL_DEFAULT¶
public static final int SCROLL_DEFAULT
SCROLL
letting Iristick Services decide which strategy to apply.- See Also:
SCROLL
SCROLL_NAVIGATION¶
public static final int SCROLL_NAVIGATION
SCROLL
requesting to scroll the container while navigating through its
children.
When the last visible child is selected and the user swipes forward, the container will scroll if possible to show more children. Similarly the container will scroll backwards when navigating beyond the first visible child.
- See Also:
SCROLL
SCROLL_PAGED¶
public static final int SCROLL_PAGED
SCROLL
requesting to first scroll the container before navigating through
its children.
When a matching view is selected, a single tap allows scrolling the contents of the view. Another tap allows navigating through the visible children without scrolling. A swipe down while navigating through the children will start scrolling again.
- See Also:
SCROLL
SCROLL_RESET_FOCUS¶
public static final int SCROLL_RESET_FOCUS
SCROLL
requesting to reset focus every time the container scrolls.
This strategy is similar to SCROLL_NAVIGATION
, but the focused child is not
remembered when the container scrolls. Instead the first (when scrolling forward) or last
(when scrolling backwards) of the newly visible children is focused.
- See Also:
SCROLL
KEYBOARD¶
public static final InteractionRule.Key<Integer> KEYBOARD
This value is only relevant for editable text views such as EditText
.
- See Also:
KEYBOARD_DEFAULT
,KEYBOARD_DISABLED
KEYBOARD_DEFAULT¶
public static final int KEYBOARD_DEFAULT
KEYBOARD
letting Iristick Services decide what to do.
When the user taps the touchpad of the headset while in
HUD mode
, a small keyboard
is shown instead of the default input method. The keyboard layout of this small keyboard is
derived from the input type
of the editable
text field. If an OnClickListener
was set for the view, its
onClick()
method is not invoked.
If the phone is not in HUD mode
, matching views will operate as if the user had
tapped on them with the touchscreen of the display. This will typically open the current
input method or invoke the onClick()
method of the
OnClickListener
if set.
- See Also:
KEYBOARD
KEYBOARD_DISABLED¶
public static final int KEYBOARD_DISABLED
KEYBOARD
requesting that no custom keyboard is shown.
When the user taps the touchpad of the headset, matching views will operate as if the user
had tapped on it with the touchscreen of the display. This will typically open the current
input method or invoke the onClick()
method of the
OnClickListener
if set.
- See Also:
KEYBOARD
KEYBOARD_VOICE¶
public static final InteractionRule.Key<Integer> KEYBOARD_VOICE
This value is only relevant for editable text views such as EditText
.
- Since:
- 1.1
- See Also:
KEYBOARD_VOICE_DEFAULT
,KEYBOARD_VOICE_NO_INHIBIT
KEYBOARD_VOICE_DEFAULT¶
public static final int KEYBOARD_VOICE_DEFAULT
KEYBOARD_VOICE
letting Iristick Services decide what to do.
When the small keyboard is shown for the matched view, all voice commands registered with
Headset.registerVoiceCommands(String[], VoiceEvent.Callback, android.os.Handler)
and any voice commands recognized by the interaction system are inhibited until the keyboard
is closed.
- Since:
- 1.1
- See Also:
KEYBOARD_VOICE
KEYBOARD_VOICE_NO_INHIBIT¶
public static final int KEYBOARD_VOICE_NO_INHIBIT
KEYBOARD_VOICE
requesting not to inhibit the other voice commands when
the keyboard is shown for the matched view.
When the small keyboard is shown for the matched view, all voice commands registered with
Headset.registerVoiceCommands(String[], VoiceEvent.Callback, android.os.Handler)
and any voice commands recognized by the interaction system are still available to the user.
- Since:
- 1.1
- See Also:
KEYBOARD_VOICE
HIGHLIGHT_STYLE¶
public static final InteractionRule.Key<Integer> HIGHLIGHT_STYLE
The interaction highlight is a visual indication of the currently focused view within your app. By tapping and swiping, the user can interact with the focused view and navigate to other views. Users should always be able to distinguish the highlight from the background.
The style of the highlight dictates how the highlight is drawn. It may be further customized by setting the stroke width and color and the fill color.
- See Also:
HIGHLIGHT_STYLE_DEFAULT
,HIGHLIGHT_STYLE_BRIGHT_DARK
,HIGHLIGHT_STYLE_DARK_BRIGHT
,HIGHLIGHT_STYLE_SINGLE_COLOR
HIGHLIGHT_STYLE_DEFAULT¶
public static final int HIGHLIGHT_STYLE_DEFAULT
HIGHLIGHT_STYLE
requesting the default highlight style.- See Also:
HIGHLIGHT_STYLE
HIGHLIGHT_STYLE_BRIGHT_DARK¶
public static final int HIGHLIGHT_STYLE_BRIGHT_DARK
HIGHLIGHT_STYLE
requesting a rounded rectangle with a two-color stroke for
the highlight.
The stroke of the highlight will have a lower luminosity in the center and a higher luminosity along the edges of the stroke.
The base color of the stroke may be configured with HIGHLIGHT_STROKE_COLOR_PRIMARY
and HIGHLIGHT_STROKE_COLOR_SECONDARY
.
Highlights with a two-color stroke are more clearly visible with both dark and light backgrounds.
- See Also:
HIGHLIGHT_STYLE
HIGHLIGHT_STYLE_DARK_BRIGHT¶
public static final int HIGHLIGHT_STYLE_DARK_BRIGHT
HIGHLIGHT_STYLE
requesting a rounded rectangle with a two-color stroke for
the highlight.
The stroke of the highlight will have a lower luminosity on the edge and a higher luminosity in the center.
The base color of the stroke may be configured with HIGHLIGHT_STROKE_COLOR_PRIMARY
and HIGHLIGHT_STROKE_COLOR_SECONDARY
.
Highlights with a two-color stroke are more clearly visible with both dark and light backgrounds.
- See Also:
HIGHLIGHT_STYLE
HIGHLIGHT_STYLE_SINGLE_COLOR¶
public static final int HIGHLIGHT_STYLE_SINGLE_COLOR
HIGHLIGHT_STYLE
requesting a rounded rectangle with a single-color stroke
for the highlight.
The stroke of the highlight will have a uniform color.
The color of the stroke may be configured with HIGHLIGHT_STROKE_COLOR_PRIMARY
and HIGHLIGHT_STROKE_COLOR_SECONDARY
.
Highlights with a single-color stroke can be harder to see with some background colors.
- See Also:
HIGHLIGHT_STYLE
HIGHLIGHT_STROKE_WIDTH¶
public static final InteractionRule.Key<Float> HIGHLIGHT_STROKE_WIDTH
When the stroke width is greater than 0.f
and the stroke color is not
HIGHLIGHT_COLOR_NONE
, a stroke is drawn around the highlight according to the style
given with HIGHLIGHT_STYLE
.
Negative values are ignored.
HIGHLIGHT_STROKE_WIDTH_DEFAULT¶
public static final float HIGHLIGHT_STROKE_WIDTH_DEFAULT
HIGHLIGHT_STROKE_WIDTH
requesting the default stroke width.- See Also:
HIGHLIGHT_STROKE_WIDTH
HIGHLIGHT_STROKE_WIDTH_NONE¶
public static final float HIGHLIGHT_STROKE_WIDTH_NONE
HIGHLIGHT_STROKE_WIDTH
requesting no stroke is drawn.- See Also:
HIGHLIGHT_STROKE_WIDTH
HIGHLIGHT_STROKE_COLOR_PRIMARY¶
public static final InteractionRule.Key<Integer> HIGHLIGHT_STROKE_COLOR_PRIMARY
The primary color is used when swiping on the touchpad will navigate the focus to a different view.
Colors with 0 alpha channel are reserved and should not be used. Use
HIGHLIGHT_COLOR_NONE
to disable the stroke
- See Also:
HIGHLIGHT_COLOR_DEFAULT
,HIGHLIGHT_COLOR_NONE
HIGHLIGHT_STROKE_COLOR_SECONDARY¶
public static final InteractionRule.Key<Integer> HIGHLIGHT_STROKE_COLOR_SECONDARY
The secondary color is used when swiping on the touchpad will interact with the currently
focused view. Examples include adjusting the value of a SeekBar
or
paged scrolling
through a ListView
.
Colors with 0 alpha channel are reserved and should not be used. Use
HIGHLIGHT_COLOR_NONE
to disable the stroke.
- See Also:
HIGHLIGHT_COLOR_DEFAULT
,HIGHLIGHT_COLOR_NONE
HIGHLIGHT_FILL_COLOR_PRIMARY¶
public static final InteractionRule.Key<Integer> HIGHLIGHT_FILL_COLOR_PRIMARY
The primary color is used when swiping on the touchpad will navigate the focus to a different view.
Colors with 0 alpha channel are reserved and should not be used. Use
HIGHLIGHT_COLOR_NONE
to disable the fill.
- See Also:
HIGHLIGHT_COLOR_DEFAULT
,HIGHLIGHT_COLOR_NONE
HIGHLIGHT_FILL_COLOR_SECONDARY¶
public static final InteractionRule.Key<Integer> HIGHLIGHT_FILL_COLOR_SECONDARY
The secondary color is used when swiping on the touchpad will interact with the currently
focused view. Examples include adjusting the value of a SeekBar
or
paged scrolling
through a ListView
.
Colors with 0 alpha channel are reserved and should not be used. Use
HIGHLIGHT_COLOR_NONE
to disable the fill.
- See Also:
HIGHLIGHT_COLOR_DEFAULT
,HIGHLIGHT_COLOR_NONE
HIGHLIGHT_COLOR_DEFAULT¶
public static final int HIGHLIGHT_COLOR_DEFAULT
HIGHLIGHT_*_COLOR_*
requesting the default color.- See Also:
HIGHLIGHT_STROKE_COLOR_PRIMARY
,HIGHLIGHT_STROKE_COLOR_SECONDARY
,HIGHLIGHT_FILL_COLOR_PRIMARY
,HIGHLIGHT_FILL_COLOR_SECONDARY
HIGHLIGHT_COLOR_NONE¶
public static final int HIGHLIGHT_COLOR_NONE
HIGHLIGHT_*_COLOR_*
requesting not to draw the specified stroke or fill.- See Also:
HIGHLIGHT_STROKE_COLOR_PRIMARY
,HIGHLIGHT_STROKE_COLOR_SECONDARY
,HIGHLIGHT_FILL_COLOR_PRIMARY
,HIGHLIGHT_FILL_COLOR_SECONDARY
Constructor Detail¶
InteractionRule¶
public InteractionRule()
Method Detail¶
create¶
@CheckResult @NonNull public static InteractionRule create()
- Returns:
- A new
InteractionRule
instance.
match¶
@NonNull public abstract InteractionRule match(@NonNull Context context, @IdRes int id)
Multiple view IDs and/or regular expressions may be added to a single rule.
- Parameters:
context
- A context to map resource IDs to fully qualified names.id
- The resource ID to match.- Returns:
- This rule instance, for chaining method calls.
- Throws:
Resources.NotFoundException
- ifid
is invalid or does not have a fully qualified name.
match¶
@NonNull public final InteractionRule match(@NonNull View view)
Multiple view IDs and/or regular expressions may be added to a single rule.
Calling this method is equivalent to calling
match(view.getContext(), view.getId())
- Parameters:
view
- The view to match.- Returns:
- This rule instance, for chaining method calls.
- Throws:
Resources.NotFoundException
- ifview
does not have a resource ID or the resource ID does not have a fully qualified name.
match¶
@NonNull public abstract InteractionRule match(@NonNull String regex)
The fully qualified resource name is the string returned by
Resources.getResourceName(int)
. It includes the package name and
the resource type.
Multiple view IDs and/or regular expressions may be added to a single rule.
- Parameters:
regex
- A regular expression used for matching view IDs.- Returns:
- This rule instance, for chaining method calls.
get¶
@CheckResult @Nullable public abstract <T> T get(@NonNull InteractionRule.Key<T> key)
- Type Parameters:
T
- The key type.- Parameters:
key
- The field to read (keys are defined as constants inInteractionRule
.- Returns:
- The value of the key, or
null
if the field is not set.
set¶
@NonNull public abstract <T> InteractionRule set(@NonNull InteractionRule.Key<T> key, @Nullable T value)
key
.- Type Parameters:
T
- The key type.- Parameters:
key
- The field to set (keys are defined as constants inInteractionRule
.value
- The value to set the field to. A value ofnull
unsets the field.- Returns:
- This rule instance, for chaining method calls.
containsKey¶
@CheckResult public abstract boolean containsKey(@NonNull InteractionRule.Key<?> key)
key
.- Parameters:
key
- The field to check.- Returns:
- Whether this rule contains a value for key.
getKeys¶
@CheckResult @NonNull public abstract List<InteractionRule.Key<?>> getKeys()
The list returned is not modifiable, so any attempts to modify it will throw an
UnsupportedOperationException
.
All values retrieved by a key from this list with get(Key)
are guaranteed
to be non-null
.
Each key is only listed once in the list. The order of the keys is undefined.
- Returns:
- A list of the keys contained in this interaction configuration for the given view id.
copy¶
@NonNull public abstract InteractionRule copy()
The copy will have the same semantics and values as the original rule. Any modification to the clone will not be reflected by the original instance and vice versa.
- Returns:
- a copy of this rule.