HeadersSupportFragment
class HeadersSupportFragment : Fragment
An fragment containing a list of row headers. Implementation must support three types of rows:
DividerRowrendered byDividerPresenter.Rowrendered byRowHeaderPresenter.SectionRowrendered byRowHeaderPresenter.
setPresenterSelector in subclass constructor to customize Presenters. App may override onCreateHeadersSupportFragment.
Summary
Nested types |
|---|
|
Interface definition for a callback to be invoked when a header item is clicked. |
|
Interface definition for a callback to be invoked when a header item is selected. |
Public constructors |
|---|
Public functions |
|
|---|---|
ObjectAdapter! |
Returns the Adapter that represents list of rows. |
ItemBridgeAdapter! |
Returns the RecyclerView.Adapter that wraps |
PresenterSelector! |
Get the presenter selector used to create and bind views. |
Int |
Gets position of currently selected row. |
VerticalGridView! |
|
Boolean |
|
View? |
onCreateView(Called to have the fragment instantiate its user interface view. |
Unit |
Called when the view previously created by |
Unit |
onSaveInstanceState(outState: Bundle!)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. |
Unit |
|
Boolean |
|
Unit |
|
Unit |
onViewCreated(view: View, savedInstanceState: Bundle?)Called immediately after |
Unit |
setAdapter(rowsAdapter: ObjectAdapter!)Sets the adapter that represents a list of rows. |
Unit |
setAlignment(windowAlignOffsetTop: Int) |
Unit |
|
Unit |
|
Unit |
setPresenterSelector(presenterSelector: PresenterSelector!)Set the presenter selector used to create and bind views. |
Unit |
setSelectedPosition(position: Int)Sets the selected row position with smooth animation. |
Unit |
setSelectedPosition(position: Int, smooth: Boolean)Sets the selected row position. |
Inherited functions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
Public functions
getAdapter
fun getAdapter(): ObjectAdapter!
Returns the Adapter that represents list of rows.
| Returns | |
|---|---|
ObjectAdapter! |
Adapter that represents list of rows. |
getBridgeAdapter
fun getBridgeAdapter(): ItemBridgeAdapter!
Returns the RecyclerView.Adapter that wraps getAdapter.
| Returns | |
|---|---|
ItemBridgeAdapter! |
The RecyclerView.Adapter that wraps |
getPresenterSelector
fun getPresenterSelector(): PresenterSelector!
Get the presenter selector used to create and bind views.
getSelectedPosition
fun getSelectedPosition(): Int
Gets position of currently selected row.
| Returns | |
|---|---|
Int |
Position of currently selected row. |
onCreateView
fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View?
Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null. This will be called between onCreate and onViewCreated.
A default View can be returned by calling Fragment in your constructor. Otherwise, this method returns null.
It is recommended to only inflate the layout in this method and move logic that operates on the returned View to onViewCreated.
If you return a View from here, you will later be called in onDestroyView when the view is being released.
| Parameters | |
|---|---|
inflater: LayoutInflater |
The LayoutInflater object that can be used to inflate any views in the fragment, |
container: ViewGroup? |
If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view. |
savedInstanceState: Bundle? |
If non-null, this fragment is being re-constructed from a previous saved state as given here. |
| Returns | |
|---|---|
View? |
Return the View for the fragment's UI, or null. |
onDestroyView
fun onDestroyView(): Unit
Called when the view previously created by onCreateView has been detached from the fragment. The next time the fragment needs to be displayed, a new view will be created. This is called after onStop and before onDestroy. It is called regardless of whether onCreateView returned a non-null view. Internally it is called after the view's state has been saved but before it has been removed from its parent.
onSaveInstanceState
fun onSaveInstanceState(outState: Bundle!): 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. If a new instance of the fragment later needs to be created, the data you place in the Bundle here will be available in the Bundle given to onCreate, onCreateView, and onViewCreated.
This corresponds to Activity.onSaveInstanceState(Bundle) and most of the discussion there applies here as well. Note however: this method may be called at any time before onDestroy. There are many situations where a fragment may be mostly torn down (such as when placed on the back stack with no UI showing), but its state will not be saved until its owning activity actually needs to save its state.
| Parameters | |
|---|---|
outState: Bundle! |
Bundle in which to place your saved state. |
onViewCreated
fun onViewCreated(view: View, savedInstanceState: Bundle?): Unit
Called immediately after onCreateView has returned, but before any saved state has been restored in to the view. This gives subclasses a chance to initialize themselves once they know their view hierarchy has been completely created. The fragment's view hierarchy is not however attached to its parent at this point.
| Parameters | |
|---|---|
view: View |
The View returned by |
savedInstanceState: Bundle? |
If non-null, this fragment is being re-constructed from a previous saved state as given here. |
setAdapter
fun setAdapter(rowsAdapter: ObjectAdapter!): Unit
Sets the adapter that represents a list of rows.
| Parameters | |
|---|---|
rowsAdapter: ObjectAdapter! |
Adapter that represents list of rows. |
setOnHeaderClickedListener
fun setOnHeaderClickedListener(
listener: HeadersSupportFragment.OnHeaderClickedListener!
): Unit
setOnHeaderViewSelectedListener
fun setOnHeaderViewSelectedListener(
listener: HeadersSupportFragment.OnHeaderViewSelectedListener!
): Unit
setPresenterSelector
fun setPresenterSelector(presenterSelector: PresenterSelector!): Unit
Set the presenter selector used to create and bind views.
setSelectedPosition
fun setSelectedPosition(position: Int): Unit
Sets the selected row position with smooth animation.
setSelectedPosition
fun setSelectedPosition(position: Int, smooth: Boolean): Unit
Sets the selected row position.