public class RowsSupportFragment extends Fragment implements BrowseSupportFragment.MainFragmentRowsAdapterProvider, BrowseSupportFragment.MainFragmentAdapterProvider
A RowsSupportFragment renders the elements of its
ObjectAdapter
as a set
of rows in a vertical list. The Adapter's PresenterSelector
must maintain subclasses
of RowPresenter
.
Modifier and Type | Class and Description |
---|---|
static class |
RowsSupportFragment.MainFragmentAdapter |
static class |
RowsSupportFragment.MainFragmentRowsAdapter |
Fragment.InstantiationException, Fragment.SavedState
Constructor and Description |
---|
RowsSupportFragment() |
Modifier and Type | Method and Description |
---|---|
void |
enableRowScaling(boolean enable)
Deprecated.
use
BrowseSupportFragment.enableRowScaling(boolean) instead. |
protected VerticalGridView |
findGridViewFromRoot(View view) |
ObjectAdapter |
getAdapter()
Returns the list of rows.
|
BrowseSupportFragment.MainFragmentAdapter |
getMainFragmentAdapter()
Returns an instance of
BrowseSupportFragment.MainFragmentAdapter that BrowseSupportFragment
would use to communicate with the target fragment. |
BrowseSupportFragment.MainFragmentRowsAdapter |
getMainFragmentRowsAdapter()
Returns an instance of
BrowseSupportFragment.MainFragmentRowsAdapter that BrowseSupportFragment
would use to communicate with the target fragment. |
BaseOnItemViewClickedListener |
getOnItemViewClickedListener()
Returns the item clicked listener.
|
BaseOnItemViewSelectedListener |
getOnItemViewSelectedListener()
Returns an item selection listener.
|
PresenterSelector |
getPresenterSelector()
Get the presenter selector used to create and bind views.
|
RowPresenter.ViewHolder |
getRowViewHolder(int position)
Get row ViewHolder at adapter position.
|
int |
getSelectedPosition()
Gets position of currently selected row.
|
boolean |
isScrolling() |
void |
onCreate(Bundle savedInstanceState)
Called to do initial creation of a fragment.
|
View |
onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
Called to have the fragment instantiate its user interface view.
|
void |
onDestroyView()
Called when the view previously created by
Fragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) has
been detached from the fragment. |
void |
onSaveInstanceState(Bundle outState)
Called to ask the fragment to save its current dynamic state, so it
can later be reconstructed in a new instance of its process is
restarted.
|
void |
onTransitionEnd() |
boolean |
onTransitionPrepare() |
void |
onTransitionStart() |
void |
onViewCreated(View view,
Bundle savedInstanceState)
Called immediately after
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
has returned, but before any saved state has been restored in to the view. |
void |
setAdapter(ObjectAdapter rowsAdapter)
Sets the adapter for the fragment.
|
void |
setAlignment(int windowAlignOffsetFromTop) |
void |
setEntranceTransitionState(boolean afterTransition)
For rows that willing to participate entrance transition, this function
hide views if afterTransition is true, show views if afterTransition is false.
|
void |
setExpand(boolean expand)
Set the visibility of titles/hovercard of browse rows.
|
void |
setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)
Sets an item clicked listener on the fragment.
|
void |
setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)
Sets an item selection listener.
|
void |
setPresenterSelector(PresenterSelector presenterSelector)
Set the presenter selector used to create and bind views.
|
void |
setSelectedPosition(int position)
Sets the selected row position with smooth animation.
|
void |
setSelectedPosition(int position,
boolean smooth)
Sets the selected row position.
|
void |
setSelectedPosition(int rowPosition,
boolean smooth,
Presenter.ViewHolderTask rowHolderTask)
Selects a Row and perform an optional task on the Row.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onStart, onStop, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, toString, unregisterForContextMenu
public BrowseSupportFragment.MainFragmentAdapter getMainFragmentAdapter()
BrowseSupportFragment.MainFragmentAdapterProvider
BrowseSupportFragment.MainFragmentAdapter
that BrowseSupportFragment
would use to communicate with the target fragment.getMainFragmentAdapter
in interface BrowseSupportFragment.MainFragmentAdapterProvider
public BrowseSupportFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter()
BrowseSupportFragment.MainFragmentRowsAdapterProvider
BrowseSupportFragment.MainFragmentRowsAdapter
that BrowseSupportFragment
would use to communicate with the target fragment.getMainFragmentRowsAdapter
in interface BrowseSupportFragment.MainFragmentRowsAdapterProvider
protected VerticalGridView findGridViewFromRoot(View view)
public void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)
View.OnClickListener
that
item presenter sets during Presenter.onCreateViewHolder(ViewGroup)
.
So in general, developer should choose one of the listeners but not both.public BaseOnItemViewClickedListener getOnItemViewClickedListener()
@Deprecated public void enableRowScaling(boolean enable)
BrowseSupportFragment.enableRowScaling(boolean)
instead.enable
- true to enable row scalingpublic void setExpand(boolean expand)
public void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)
public BaseOnItemViewSelectedListener getOnItemViewSelectedListener()
public RowPresenter.ViewHolder getRowViewHolder(int position)
position
- Position of row in adapter.public void onCreate(Bundle savedInstanceState)
Fragment
Fragment.onAttach(Activity)
and before
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
.
Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, see Fragment.onActivityCreated(Bundle)
.
Any restored child fragments will be created before the base
Fragment.onCreate
method returns.
public void onViewCreated(View view, Bundle savedInstanceState)
Fragment
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
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.view
- The View returned by Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
.savedInstanceState
- If non-null, this fragment is being re-constructed
from a previous saved state as given here.public void onDestroyView()
Fragment
Fragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
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 Fragment.onStop()
and before Fragment.onDestroy()
. It is called
regardless of whether Fragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
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.public boolean onTransitionPrepare()
public void onTransitionEnd()
public void setEntranceTransitionState(boolean afterTransition)
public void setSelectedPosition(int rowPosition, boolean smooth, Presenter.ViewHolderTask rowHolderTask)
setSelectedPosition(10, true, new ListRowPresenterSelectItemViewHolderTask(5))
Scroll to 11th row and selects 6th item on that row. The method will be ignored if
RowsSupportFragment has not been created (i.e. before onCreateView(LayoutInflater,
ViewGroup, Bundle)
).rowPosition
- Which row to select.smooth
- True to scroll to the row, false for no animation.rowHolderTask
- Task to perform on the Row.public boolean isScrolling()
public void setAlignment(int windowAlignOffsetFromTop)
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Fragment
Fragment.onCreate(Bundle)
and Fragment.onActivityCreated(Bundle)
.
If you return a View from here, you will later be called in
Fragment.onDestroyView()
when the view is being released.
onCreateView
in class Fragment
inflater
- The LayoutInflater object that can be used to inflate
any views in the fragment,container
- 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
- If non-null, this fragment is being re-constructed
from a previous saved state as given here.public void onSaveInstanceState(Bundle outState)
Fragment
Fragment.onCreate(Bundle)
,
Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
, and
Fragment.onActivityCreated(Bundle)
.
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 Fragment.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.
onSaveInstanceState
in class Fragment
outState
- Bundle in which to place your saved state.public final void setPresenterSelector(PresenterSelector presenterSelector)
public final PresenterSelector getPresenterSelector()
public final void setAdapter(ObjectAdapter rowsAdapter)
public final ObjectAdapter getAdapter()
public void setSelectedPosition(int position)
public int getSelectedPosition()
public void setSelectedPosition(int position, boolean smooth)
public void onTransitionStart()