VerticalGridFragment

Added in 1.1.0
Deprecated in 1.1.0

public class VerticalGridFragment extends BaseFragment


A fragment for creating leanback vertical grids.

Renders a vertical grid of objects given a VerticalGridPresenter and an ObjectAdapter.

Summary

Public constructors

Public methods

@Nullable ObjectAdapter

Returns the object adapter.

@Nullable VerticalGridPresenter

Returns the grid presenter.

@Nullable OnItemViewClickedListener

Returns the item clicked listener.

@Nullable View
onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    Bundle savedInstanceState
)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

Sets the object adapter for the fragment.

void

Sets the grid presenter.

void

Sets an item clicked listener.

void

Sets an item selection listener.

void
setSelectedPosition(int position)

Sets the selected item position.

Protected methods

@NonNull Object

Create entrance transition.

void
runEntranceTransition(@Nullable Object entranceTransition)

Run entrance transition.

Inherited Constants

From android.content.ComponentCallbacks2
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Inherited methods

From androidx.leanback.app.BaseFragment
final ProgressBarManager

Returns the ProgressBarManager.

void
onCreate(Bundle savedInstanceState)

This method is deprecated.

void

Callback when entrance transition is ended.

void

Callback when entrance transition is prepared.

void

Callback when entrance transition is started.

void
onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)

This method is deprecated.

void

Enables entrance transition.

void

When fragment finishes loading data, it should call startEntranceTransition() to execute the entrance transition. startEntranceTransition() will start transition only if both two conditions are satisfied:

From androidx.leanback.app.BrandedFragment
@Nullable Drawable

Returns the badge drawable used in the fragment title.

int

Returns the color used to draw the search affordance.

@Nullable SearchOrbView.Colors

Returns the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

@Nullable CharSequence

Returns the title text for the fragment.

@Nullable View

Returns the view that implements TitleViewAdapter.Provider.

@Nullable TitleViewAdapter

Returns the TitleViewAdapter implemented by title view.

void
installTitleView(
    @NonNull LayoutInflater inflater,
    @NonNull ViewGroup parent,
    @Nullable Bundle savedInstanceState
)

Inflate title view and add to parent.

final boolean

Returns true/false to indicate the visibility of TitleView.

@NonNull View
onInflateTitleView(
    @NonNull LayoutInflater inflater,
    @Nullable ViewGroup parent,
    @Nullable Bundle savedInstanceState
)

Called by installTitleView to inflate title view.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

Sets the drawable displayed in the fragment title.

void

Sets a click listener for the search affordance.

void

Sets the color used to draw the search affordance.

void

Sets the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

void

Sets title text for the fragment.

void

Sets the view that implemented TitleViewAdapter.

void
showTitle(int flags)

Changes title view's components visibility and shows title.

void
showTitle(boolean show)

Shows or hides the title view.

From android.app.Fragment
void
dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

This method is deprecated.

final boolean

This method is deprecated.

final Activity

This method is deprecated.

boolean

This method is deprecated.

boolean

This method is deprecated.

final Bundle

This method is deprecated.

final FragmentManager

This method is deprecated.

Context

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final FragmentManager

This method is deprecated.

final Object

This method is deprecated.

final int

This method is deprecated.

final LayoutInflater

This method is deprecated.

LoaderManager

This method is deprecated.

final Fragment

This method is deprecated.

Transition

This method is deprecated.

final Resources

This method is deprecated.

final boolean

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final String
getString(int resId)

This method is deprecated.

final String

This method is deprecated.

final Fragment

This method is deprecated.

final int

This method is deprecated.

final CharSequence
getText(int resId)

This method is deprecated.

boolean

This method is deprecated.

View

This method is deprecated.

final int

This method is deprecated.

static Fragment
instantiate(Context context, String fname)

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

void
onActivityCreated(Bundle savedInstanceState)

This method is deprecated.

void
onActivityResult(int requestCode, int resultCode, Intent data)

This method is deprecated.

void
onAttach(Context context)

This method is deprecated.

void
onAttachFragment(Fragment childFragment)

This method is deprecated.

void

This method is deprecated.

boolean

This method is deprecated.

void
onCreate(Bundle savedInstanceState)

This method is deprecated.

Animator
onCreateAnimator(int transit, boolean enter, int nextAnim)

This method is deprecated.

void
onCreateContextMenu(
    ContextMenu menu,
    View v,
    ContextMenu.ContextMenuInfo menuInfo
)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

LayoutInflater
onGetLayoutInflater(Bundle savedInstanceState)

This method is deprecated.

void
onHiddenChanged(boolean hidden)

This method is deprecated.

void
onInflate(AttributeSet attrs, Bundle savedInstanceState)

This method is deprecated.

void

This method is deprecated.

void
onMultiWindowModeChanged(
    boolean isInMultiWindowMode,
    Configuration newConfig
)

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onPictureInPictureModeChanged(
    boolean isInPictureInPictureMode,
    Configuration newConfig
)

This method is deprecated.

void

This method is deprecated.

void
onRequestPermissionsResult(
    int requestCode,
    String[] permissions,
    int[] grantResults
)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onTrimMemory(int level)

This method is deprecated.

void
onViewCreated(View view, Bundle savedInstanceState)

This method is deprecated.

void
onViewStateRestored(Bundle savedInstanceState)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

final void
requestPermissions(String[] permissions, int requestCode)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setHasOptionsMenu(boolean hasMenu)

This method is deprecated.

void

This method is deprecated.

void
setMenuVisibility(boolean menuVisible)

This method is deprecated.

void

This method is deprecated.

void
setRetainInstance(boolean retain)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setTargetFragment(Fragment fragment, int requestCode)

This method is deprecated.

void
setUserVisibleHint(boolean isVisibleToUser)

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void
startActivityForResult(Intent intent, int requestCode)

This method is deprecated.

void
startIntentSenderForResult(
    IntentSender intent,
    int requestCode,
    Intent fillInIntent,
    int flagsMask,
    int flagsValues,
    int extraFlags,
    Bundle options
)

This method is deprecated.

void

This method is deprecated.

String

This method is deprecated.

void

This method is deprecated.

Public constructors

VerticalGridFragment

Added in 1.1.0
Deprecated in 1.1.0
public VerticalGridFragment()

Public methods

getAdapter

Added in 1.1.0
Deprecated in 1.1.0
public @Nullable ObjectAdapter getAdapter()

Returns the object adapter.

getGridPresenter

Added in 1.1.0
Deprecated in 1.1.0
public @Nullable VerticalGridPresenter getGridPresenter()

Returns the grid presenter.

getOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
public @Nullable OnItemViewClickedListener getOnItemViewClickedListener()

Returns the item clicked listener.

onCreateView

Added in 1.1.0
Deprecated in 1.1.0
public @Nullable View onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    Bundle savedInstanceState
)

onDestroyView

public void onDestroyView()

onStart

public void onStart()

setAdapter

Added in 1.1.0
Deprecated in 1.1.0
public void setAdapter(@Nullable ObjectAdapter adapter)

Sets the object adapter for the fragment.

setGridPresenter

Added in 1.1.0
Deprecated in 1.1.0
public void setGridPresenter(@NonNull VerticalGridPresenter gridPresenter)

Sets the grid presenter.

setOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
public void setOnItemViewClickedListener(
    @Nullable OnItemViewClickedListener listener
)

Sets an item clicked listener.

setOnItemViewSelectedListener

Added in 1.1.0
Deprecated in 1.1.0
public void setOnItemViewSelectedListener(
    @Nullable OnItemViewSelectedListener listener
)

Sets an item selection listener.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
public void setSelectedPosition(int position)

Sets the selected item position.

Protected methods

createEntranceTransition

protected @NonNull Object createEntranceTransition()

Create entrance transition. Subclass can override to load transition from resource or construct manually. Typically app does not need to override the default transition that browse and details provides.

runEntranceTransition

protected void runEntranceTransition(@Nullable Object entranceTransition)

Run entrance transition. Subclass may use TransitionManager to perform go(Scene) or beginDelayedTransition(). App should not override the default implementation of browse and details fragment.