belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
GuidedActionsStylist
public
class
GuidedActionsStylist
extends Object
implements
FragmentAnimationProvider
java.lang.Object | |
↳ | android.support.v17.leanback.widget.GuidedActionsStylist |
GuidedActionsStylist is used within a GuidedStepFragment
to supply the right-side panel where users can take actions. It consists of a container for the
list of actions, and a stationary selector view that indicates visually the location of focus.
GuidedActionsStylist has two different layouts: default is for normal actions including text,
radio, checkbox, DatePicker, etc, the other when setAsButtonActions()
is called is
recommended for button actions such as "yes", "no".
Many aspects of the base GuidedActionsStylist can be customized through theming; see the theme attributes below. Note that these attributes are not set on individual elements in layout XML, but instead would be set in a custom theme. See Styles and Themes for more information.
If these hooks are insufficient, this class may also be subclassed. Subclasses may wish to
override the onProvideLayoutId()
method to change the layout used to display the
list container and selector; override onProvideItemLayoutId(int)
and
getItemViewType(GuidedAction)
method to change the layout used to display each action.
To support a "click to activate" view similar to DatePicker, app needs:
onProvideItemLayoutId(int)
and getItemViewType(GuidedAction)
,
provides a layout id for the action.
setActivated(boolean)
.
onBindActivatorView(ViewHolder, GuidedAction)
to populate values into View.
onUpdateActivatorView(ViewHolder, GuidedAction)
to update action.
Note: If an alternate list layout is provided, the following view IDs must be supplied:
These view IDs must be present in order for the stylist to function. The list ID must correspond
to a VerticalGridView
or subclass.
If an alternate item layout is provided, the following view IDs should be used to refer to base elements:
guidedactions_item_content
guidedactions_item_title
guidedactions_item_description
guidedactions_item_icon
guidedactions_item_checkmark
guidedactions_item_chevron
These view IDs are allowed to be missing, in which case the corresponding views in GuidedActionsStylist.ViewHolder
will be null.
In order to support editable actions, the view associated with guidedactions_item_title should
be a subclass of EditText
, and should satisfy the ImeKeyMonitor
interface.
See also:
Summary
Nested classes | |
---|---|
class |
GuidedActionsStylist.ViewHolder
ViewHolder caches information about the action item layouts' subviews. |
XML attributes | |
---|---|
LeanbackGuidedStepTheme_guidedActionDescriptionMinLines |
|
LeanbackGuidedStepTheme_guidedActionDisabledChevronAlpha |
|
LeanbackGuidedStepTheme_guidedActionEnabledChevronAlpha |
|
LeanbackGuidedStepTheme_guidedActionItemCheckmarkStyle |
|
LeanbackGuidedStepTheme_guidedActionItemChevronStyle |
|
LeanbackGuidedStepTheme_guidedActionItemContainerStyle |
|
LeanbackGuidedStepTheme_guidedActionItemContentStyle |
|
LeanbackGuidedStepTheme_guidedActionItemDescriptionStyle |
|
LeanbackGuidedStepTheme_guidedActionItemIconStyle |
|
LeanbackGuidedStepTheme_guidedActionItemTitleStyle |
|
LeanbackGuidedStepTheme_guidedActionPressedAnimation |
|
LeanbackGuidedStepTheme_guidedActionTitleMaxLines |
|
LeanbackGuidedStepTheme_guidedActionTitleMinLines |
|
LeanbackGuidedStepTheme_guidedActionUnpressedAnimation |
|
LeanbackGuidedStepTheme_guidedActionVerticalPadding |
|
LeanbackGuidedStepTheme_guidedActionsListStyle |
|
LeanbackGuidedStepTheme_guidedActionsSelectorDrawable |
|
LeanbackGuidedStepTheme_guidedButtonActionsListStyle |
|
LeanbackGuidedStepTheme_guidedStepImeAppearingAnimation |
|
LeanbackGuidedStepTheme_guidedStepImeDisappearingAnimation |
|
LeanbackGuidedStepTheme_guidedSubActionsListStyle |
Constants | |
---|---|
int |
VIEW_TYPE_DATE_PICKER
ViewType for DatePicker. |
int |
VIEW_TYPE_DEFAULT
Default viewType that associated with default layout Id for the action item. |
Public constructors | |
---|---|
GuidedActionsStylist()
|
Public methods | |
---|---|
void
|
collapseAction(boolean withTransition)
Collapse expanded action. |
void
|
expandAction(GuidedAction action, boolean withTransition)
Expand an action. |
VerticalGridView
|
getActionsGridView()
Returns the VerticalGridView that displays the list of GuidedActions. |
GuidedAction
|
getExpandedAction()
|
int
|
getItemViewType(GuidedAction action)
Return view type of action, each different type can have differently associated layout Id. |
VerticalGridView
|
getSubActionsGridView()
Returns the VerticalGridView that displays the sub actions list of an expanded action. |
final
boolean
|
isBackKeyToCollapseActivatorView()
|
final
boolean
|
isBackKeyToCollapseSubActions()
|
boolean
|
isButtonActions()
Returns true if it is button actions list, false for normal actions list. |
boolean
|
isExpandTransitionSupported()
Returns if expand/collapse animation is supported. |
boolean
|
isExpanded()
|
boolean
|
isInExpandTransition()
Returns true if it is running an expanding or collapsing transition, false otherwise. |
boolean
|
isSubActionsExpanded()
|
void
|
onAnimateItemChecked(GuidedActionsStylist.ViewHolder vh, boolean checked)
Animates the view holder's view (or subviews thereof) when the action has had its check state changed. |
void
|
onAnimateItemFocused(GuidedActionsStylist.ViewHolder vh, boolean focused)
Animates the view holder's view (or subviews thereof) when the action has had its focus state changed. |
void
|
onAnimateItemPressed(GuidedActionsStylist.ViewHolder vh, boolean pressed)
Animates the view holder's view (or subviews thereof) when the action has had its press state changed. |
void
|
onAnimateItemPressedCancelled(GuidedActionsStylist.ViewHolder vh)
Resets the view holder's view to unpressed state. |
void
|
onBindActivatorView(GuidedActionsStylist.ViewHolder vh, GuidedAction action)
Performs binding activator view value to action. |
void
|
onBindCheckMarkView(GuidedActionsStylist.ViewHolder vh, GuidedAction action)
Sets states of check mark view, called by |
void
|
onBindChevronView(GuidedActionsStylist.ViewHolder vh, GuidedAction action)
Sets states of chevron view, called by |
void
|
onBindViewHolder(GuidedActionsStylist.ViewHolder vh, GuidedAction action)
Binds a |
View
|
onCreateView(LayoutInflater inflater, ViewGroup container)
Creates a view appropriate for displaying a list of GuidedActions, using the provided inflater and container. |
GuidedActionsStylist.ViewHolder
|
onCreateViewHolder(ViewGroup parent, int viewType)
Constructs a |
GuidedActionsStylist.ViewHolder
|
onCreateViewHolder(ViewGroup parent)
Constructs a |
void
|
onDestroyView()
Called when destroy the View created by GuidedActionsStylist. |
void
|
onImeAppearing(List<Animator> animators)
Animates the fragment in response to the IME appearing. |
void
|
onImeDisappearing(List<Animator> animators)
Animates the fragment in response to the IME disappearing. |
int
|
onProvideItemLayoutId()
Provides the resource ID of the layout defining the view for an individual guided actions. |
int
|
onProvideItemLayoutId(int viewType)
Provides the resource ID of the layout defining the view for an individual guided actions. |
int
|
onProvideLayoutId()
Provides the resource ID of the layout defining the host view for the list of guided actions. |
boolean
|
onUpdateActivatorView(GuidedActionsStylist.ViewHolder vh, GuidedAction action)
Performs updating GuidedAction from activator view. |
void
|
onUpdateExpandedViewHolder(GuidedActionsStylist.ViewHolder avh)
Expand or collapse GuidedActionStylist. |
void
|
openInEditMode(GuidedAction action)
Switches action to edit mode and pops up the keyboard. |
void
|
setAsButtonActions()
Choose the layout resource for button actions in |
final
void
|
setBackKeyToCollapseActivatorView(boolean backToCollapse)
Enable or disable using BACK key to collapse |
final
void
|
setBackKeyToCollapseSubActions(boolean backToCollapse)
Enable or disable using BACK key to collapse sub actions list. |
void
|
setEditingMode(GuidedActionsStylist.ViewHolder vh, GuidedAction action, boolean editing)
This method was deprecated in API level 25.1.0. This method is for internal library use only and should not be called directly. |
void
|
setExpandedViewHolder(GuidedActionsStylist.ViewHolder avh)
This method was deprecated
in API level 25.1.0.
use |