Interface IFocusState
interface IFocusState
Extends com.amazon.apmf.IStandard
Interface for managing focus state of the Views.
Methods
setFocusable()
Sets whether this View can receive focus. Setting focusable = false will also ensure that this View is not focusable in touch mode.voidsetFocusable(IView*view,boolfocusable)
Parameters
view
IView* — Required
The View for which the focusability is being set.
focusable
bool — Required
true if this View can receive focus, false otherwise.
isFocusable()
Gets whether this View can receive focus.boolisFocusable(IView*view)
Parameters
view
IView* — Required
The View for which to check focusability on.
Returns
bool
True if the specified View can take focus, or False otherwise.
setFocusableInTouchMode()
Sets whether this View can receive focus while in touch mode.voidsetFocusableInTouchMode(IView*view,boolfocusable)
Parameters
view
IView* — Required
The View for which the focusability is being set.
focusable
bool — Required
true if this View can receive focus while in touch mode, false otherwise
isFocusableInTouchMode()
Gets whether this View can receive focus while in touch mode.boolisFocusableInTouchMode(IView*view)
Parameters
view
IView* — Required
The View for which to check focusability on.
Returns
bool
true if this View can receive focus while in touch mode, false otherwise
isFocused()
Evaluate whether the current View has focus or not.boolisFocused(IView*view)
Parameters
view
IView* — Required
The View to check focus on.
Returns
bool
True if the specified View has focus, or False otherwise.
setDescendantFocusability()
Set descendant focusability of this View. This defines the relationship between this View and its descendants when searching for a View to take focus in requestFocus(view, direction, previouslyFocusedRect).voidsetDescendantFocusability(IView*view,DescendantFocusabilitydescendantFocusability)
Parameters
view
IView* — Required
The View for which to set descendant focusability.
descendantFocusability
DescendantFocusability — Required
One of DescendantFocusability enum value.
getDescendantFocusability()
Gets descendant focusability of this View. The descendant focusability defines the relationship between this View and its descendants when searching for a View to take focus in requestFocus(view, direction, previouslyFocusedRect).DescendantFocusabilitygetDescendantFocusability(IView*view)
Parameters
view
IView* — Required
The View for which to get descendant focusability.
Returns
DescendantFocusability
One of DescendantFocusability value.
hasFocus()
Evaluate whether the current View or one of its descendants has focus.boolhasFocus(IView*view)
Parameters
view
IView* — Required
The View for which to check if it has focus or contains a focused descendant View.
Returns
bool
True if the specified View has or contains focus, otherwise false.
findFocus()
Find the View in the hierarchy rooted at this View that currently has focus.IView?findFocus(IView*view)
Parameters
view
IView* — Required
The View hierarchy root to find a focused View in.
Returns
IView?
The return value is optional and might be absent.
The View that currently has focus, or nullptr if no focused View can be found.

