Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

GuidedStepSupportFragment

open class GuidedStepSupportFragment : Fragment, FocusListener
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.leanback.app.GuidedStepSupportFragment

A GuidedStepSupportFragment is used to guide the user through a decision or series of decisions. It is composed of a guidance view on the left and a view on the right containing a list of possible actions.

Basic Usage

Clients of GuidedStepSupportFragment must create a custom subclass to attach to their Activities. This custom subclass provides the information necessary to construct the user interface and respond to user actions. At a minimum, subclasses should override:

Clients use following helper functions to add GuidedStepSupportFragment to Activity or FragmentManager:

Theming and Stylists

GuidedStepSupportFragment delegates its visual styling to classes called stylists. The is responsible for the left guidance view, while the is responsible for the right actions view. The stylists use theme attributes to derive values associated with the presentation, such as colors, animations, etc. Most simple visual aspects of GuidanceStylist and GuidedActionsStylist can be customized via theming; see their documentation for more information.

GuidedStepSupportFragments must have access to an appropriate theme in order for the stylists to function properly. Specifically, the fragment must receive androidx.leanback.R.style#Theme_Leanback_GuidedStep, or a theme whose parent is is set to that theme. Themes can be provided in one of three ways:

  • The simplest way is to set the theme for the host Activity to the GuidedStep theme or a theme that derives from it.
  • If the Activity already has a theme and setting its parent theme is inconvenient, the existing Activity theme can have an entry added for the attribute androidx.leanback.R.styleable#LeanbackGuidedStepTheme_guidedStepTheme. If present, this theme will be used by GuidedStepSupportFragment as an overlay to the Activity's theme.
  • Finally, custom subclasses of GuidedStepSupportFragment may provide a theme through the method. This can be useful if a subclass is used across multiple Activities.

If the theme is provided in multiple ways, the onProvideTheme override has priority, followed by the Activity's theme. (Themes whose parent theme is already set to the guided step theme do not need to set the guidedStepTheme attribute; if set, it will be ignored.)

If themes do not provide enough customizability, the stylists themselves may be subclassed and provided to the GuidedStepSupportFragment through the onCreateGuidanceStylist and methods. The stylists have simple hooks so that subclasses may override layout files; subclasses may also have more complex logic to determine styling.

Guided sequences

GuidedStepSupportFragments can be grouped together to provide a guided sequence. GuidedStepSupportFragments grouped as a sequence use custom animations provided by GuidanceStylist and GuidedActionsStylist (or subclasses) during transitions between steps. Clients should use #add to place subsequent GuidedFragments onto the fragment stack so that custom animations are properly configured. (Custom animations are triggered automatically when the fragment stack is subsequently popped by any normal mechanism.)

Note: Currently GuidedStepSupportFragments grouped in this way must all be defined programmatically, rather than in XML. This restriction may be removed in the future. androidx.leanback.R.attr#guidedStepTheme androidx.leanback.R.attr#guidedStepBackground androidx.leanback.R.attr#guidedActionContentWidthWeight androidx.leanback.R.attr#guidedActionContentWidthWeightTwoPanels androidx.leanback.R.attr#guidedActionsBackground androidx.leanback.R.attr#guidedActionsBackgroundDark androidx.leanback.R.attr#guidedActionsElevation

Summary

Constants
static String

Fragment argument name for UI style.

static Int

One possible value of argument EXTRA_UI_STYLE.

static Int

static Int

Default value for argument EXTRA_UI_STYLE.

static Int

This is the case that we use GuidedStepSupportFragment to replace another existing GuidedStepSupportFragment when moving forward to next step.

Public constructors

Public methods
open static Int
add(fragmentManager: FragmentManager!, fragment: GuidedStepSupportFragment!)

Adds the specified GuidedStepSupportFragment to the fragment stack, replacing any existing GuidedStepSupportFragments in the stack, and configuring the fragment-to-fragment custom transitions.

open static Int
add(fragmentManager: FragmentManager!, fragment: GuidedStepSupportFragment!, id: Int)

Adds the specified GuidedStepSupportFragment to the fragment stack, replacing any existing GuidedStepSupportFragments in the stack, and configuring the fragment-to-fragment custom transitions.

open static Int

Adds the specified GuidedStepSupportFragment as content of Activity; no backstack entry is added so the activity will be dismissed when BACK key is pressed.

open Unit
collapseAction(withTransition: Boolean)

Collapse action which either has a sub actions list or action with GuidedAction#hasEditableActivatorView() is true.

open Unit

Collapse sub actions list.

open Unit
expandAction(action: GuidedAction!, withTransition: Boolean)

Expand a given action with sub actions list or GuidedAction#hasEditableActivatorView() is true.

open Unit

Expand a given action's sub actions list.

open GuidedAction!

Find GuidedAction by Id.

open Int

Find GuidedAction position in array by Id.

open GuidedAction!

Find button GuidedAction by Id.

open Int

Find button GuidedAction position in array by Id.

open Unit

Convenient method to close GuidedStepSupportFragments on top of other content or finish Activity if GuidedStepSupportFragments were started in a separate activity.

open View!

Returns the view corresponding to the action at the indicated position in the list of actions for this fragment.

open MutableList<GuidedAction!>!

Returns the list of GuidedActions that the user may take in this fragment.

open View!

Returns the view corresponding to the button action at the indicated position in the list of actions for this fragment.

open MutableList<GuidedAction!>!

Returns the list of button GuidedActions that the user may take in this fragment.

open static GuidedStepSupportFragment!

Returns the current GuidedStepSupportFragment on the fragment transaction stack.

open GuidanceStylist!

Returns the GuidanceStylist that displays guidance information for the user.

open GuidedActionsStylist!

Returns the GuidedActionsStylist that displays the actions the user may take.

open GuidedActionsStylist!

Returns the GuidedActionsStylist that displays the button actions the user may take.

open Int

Returns the position if the currently selected GuidedAction.

open Int

Returns the position if the currently selected button GuidedAction.

open Int

Read UI style from fragment arguments.

open Boolean

open Boolean

Returns true if allows focus out of end edge of GuidedStepSupportFragment, false otherwise.

open Boolean

Returns true if allows focus out of start edge of GuidedStepSupportFragment, false otherwise.

open Boolean

open Unit

Notify an action has changed and update its UI.

open Unit

Notify an button action has changed and update its UI.

open Unit
onCreate(savedInstanceState: Bundle?)

Called to do initial creation of a fragment.

open Unit
onCreateActions(@NonNull actions: MutableList<GuidedAction!>, savedInstanceState: Bundle!)

Fills out the set of actions available to the user.

open GuidedActionsStylist!

Creates the presenter used to style the guided actions panel.

open View!
onCreateBackgroundView(inflater: LayoutInflater!, container: ViewGroup!, savedInstanceState: Bundle!)

Called by onCreateView to inflate background view.

open Unit
onCreateButtonActions(@NonNull actions: MutableList<GuidedAction!>, savedInstanceState: Bundle!)

Fills out the set of actions shown at right available to the user.

open GuidedActionsStylist!

Creates the presenter used to style a sided actions panel for button only.

open GuidanceStylist.Guidance
onCreateGuidance(savedInstanceState: Bundle!)

Returns the information required to provide guidance to the user.

open GuidanceStylist!

Creates the presenter used to style the guidance panel.

open View?
onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?)

Called to have the fragment instantiate its user interface view.

open Unit

Called when the view previously created by onCreateView has been detached from the fragment.

open Unit

Callback invoked when an action is taken by the user.

open Unit

Callback invoked when an action has been canceled editing, for example when user closes IME window by BACK key.

open Unit

Callback invoked when an action's title or description has been edited, this happens either when user clicks confirm button in IME or user closes IME window by BACK key.

open Long

Callback invoked when an action has been edited, for example when user clicks confirm button in IME window.

open Unit

Callback invoked when an action is focused (made to be the current selection) by the user.

open Int

Returns the theme used for styling the fragment.

open Unit

open Unit

Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted.

open Boolean

Callback invoked when an action in sub actions is taken by the user.

open Unit

Opens the provided action in edit mode and raises ime.

open Unit
popBackStackToGuidedStepSupportFragment(guidedStepFragmentClass: Class<*>!, flags: Int)

Convenient method to pop to fragment with Given class.

open Unit

Sets the list of GuidedActions that the user may take in this fragment.

open Unit

Sets the RecyclerView DiffCallback used when setActions(List) is called.

open Unit

Sets the list of button GuidedActions that the user may take in this fragment.

open Unit

Scrolls the action list to the position indicated, selecting that action's view.

open Unit

Scrolls the action list to the position indicated, selecting that button action's view.

open Unit
setUiStyle(style: Int)

Set UI style to fragment arguments.

Protected methods
open Unit

Called when this fragment is added to FragmentTransaction with UI_STYLE_REPLACE (aka when the GuidedStepSupportFragment replacing an existing GuidedStepSupportFragment).

open Unit

Called by Constructor to provide fragment transitions.

Inherited functions