Most visited

Recently visited

BrandedSupportFragment

public class BrandedSupportFragment
extends Fragment

java.lang.Object
   ↳ android.support.v4.app.Fragment
     ↳ android.support.v17.leanback.app.BrandedSupportFragment
Known Direct Subclasses
Known Indirect Subclasses


Fragment class for managing search and branding using a view that implements TitleViewAdapter.Provider.

Summary

Public constructors

BrandedSupportFragment()

Public methods

Drawable getBadgeDrawable()

Returns the badge drawable used in the fragment title.

int getSearchAffordanceColor()

Returns the color used to draw the search affordance.

SearchOrbView.Colors getSearchAffordanceColors()

Returns the SearchOrbView.Colors used to draw the search affordance.

CharSequence getTitle()

Returns the title text for the fragment.

View getTitleView()

Returns the view that implements TitleViewAdapter.Provider.

TitleViewAdapter getTitleViewAdapter()

Returns the TitleViewAdapter implemented by title view.

void installTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

Inflate title view and add to parent.

final boolean isShowingTitle()

Returns true/false to indicate the visibility of TitleView.

void onDestroyView()

Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle) has been detached from the fragment.

View onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

Called by installTitleView(LayoutInflater, ViewGroup, Bundle) to inflate title view.

void onPause()

Called when the Fragment is no longer resumed.

void onResume()

Called when the fragment is visible to the user and actively running.

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 onStart()

Called when the Fragment is visible to the user.

void onViewCreated(View view, Bundle savedInstanceState)

Called immediately after onCreateView(LayoutInflater, ViewGroup, Bundle) has returned, but before any saved state has been restored in to the view.

void setBadgeDrawable(Drawable drawable)

Sets the drawable displayed in the fragment title.

void setOnSearchClickedListener(View.OnClickListener listener)

Sets a click listener for the search affordance.

void setSearchAffordanceColor(int color)

Sets the color used to draw the search affordance.

void setSearchAffordanceColors(SearchOrbView.Colors colors)

Sets the SearchOrbView.Colors used to draw the search affordance.

void setTitle(CharSequence title)

Sets title text for the fragment.

void setTitleView(View titleView)

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.

Inherited methods

From class android.support.v4.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener

Public constructors

BrandedSupportFragment

BrandedSupportFragment ()

Public methods

getBadgeDrawable

Drawable getBadgeDrawable ()

Returns the badge drawable used in the fragment title.

Returns
Drawable The badge drawable used in the fragment title.

getSearchAffordanceColor

int getSearchAffordanceColor ()

Returns the color used to draw the search affordance.

Returns
int

getSearchAffordanceColors

SearchOrbView.Colors getSearchAffordanceColors ()

Returns the SearchOrbView.Colors used to draw the search affordance.

Returns
SearchOrbView.Colors

getTitle

CharSequence getTitle ()

Returns the title text for the fragment.

Returns
CharSequence Title text for the fragment.

getTitleView

View getTitleView ()

Returns the view that implements TitleViewAdapter.Provider.

Returns
View The view that implements TitleViewAdapter.Provider.

getTitleViewAdapter

TitleViewAdapter getTitleViewAdapter ()

Returns the TitleViewAdapter implemented by title view.

Returns
TitleViewAdapter The TitleViewAdapter implemented by title view.

installTitleView

void installTitleView (LayoutInflater inflater, 
                ViewGroup parent, 
                Bundle savedInstanceState)

Inflate title view and add to parent. This method should be called in onCreateView(LayoutInflater, ViewGroup, Bundle).

Parameters
inflater LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,
parent ViewGroup: Parent of title view.
savedInstanceState Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.

isShowingTitle

boolean isShowingTitle ()

Returns true/false to indicate the visibility of TitleView.

Returns
boolean boolean to indicate whether or not it's showing the title.

onDestroyView

void onDestroyView ()

Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, 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 onStop() and before onDestroy(). It is called regardless of whether onCreateView(LayoutInflater, ViewGroup, 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.

onInflateTitleView

View onInflateTitleView (LayoutInflater inflater, 
                ViewGroup parent, 
                Bundle savedInstanceState)

Called by installTitleView(LayoutInflater, ViewGroup, Bundle) to inflate title view. Default implementation uses layout file lb_browse_title. Subclass may override and use its own layout, the layout must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider. Subclass may return null if no title is needed.

Parameters
inflater LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,
parent ViewGroup: Parent of title view.
savedInstanceState Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
View Title view which must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider, or null for no title view.

onPause

void onPause ()

Called when the Fragment is no longer resumed. This is generally tied to Activity.onPause of the containing Activity's lifecycle.

onResume

void onResume ()

Called when the fragment is visible to the user and actively running. This is generally tied to Activity.onResume of the containing Activity's lifecycle.

onSaveInstanceState

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. 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(Bundle), onCreateView(LayoutInflater, ViewGroup, Bundle), and 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 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.

onStart

void onStart ()

Called when the Fragment is visible to the user. This is generally tied to Activity.onStart of the containing Activity's lifecycle.

onViewCreated

void onViewCreated (View view, 
                Bundle savedInstanceState)

Called immediately after 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.

Parameters
view View: The View returned by onCreateView(LayoutInflater, ViewGroup, Bundle).
savedInstanceState Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.

setBadgeDrawable

void setBadgeDrawable (Drawable drawable)

Sets the drawable displayed in the fragment title.

Parameters
drawable Drawable: The Drawable to display in the fragment title.

setOnSearchClickedListener

void setOnSearchClickedListener (View.OnClickListener listener)

Sets a click listener for the search affordance.

The presence of a listener will change the visibility of the search affordance in the fragment title. When set to non-null, the title will contain an element that a user may click to begin a search.

The listener's onClick method will be invoked when the user clicks on the search element.

Parameters
listener View.OnClickListener: The listener to call when the search element is clicked.

setSearchAffordanceColor

void setSearchAffordanceColor (int color)

Sets the color used to draw the search affordance. A default brighter color will be set by the framework.

Parameters
color int: The color to use for the search affordance.

setSearchAffordanceColors

void setSearchAffordanceColors (SearchOrbView.Colors colors)

Sets the SearchOrbView.Colors used to draw the search affordance.

Parameters
colors SearchOrbView.Colors: Colors used to draw search affordance.

setTitle

void setTitle (CharSequence title)

Sets title text for the fragment.

Parameters
title CharSequence: The title text of the fragment.

setTitleView

void setTitleView (View titleView)

Sets the view that implemented TitleViewAdapter.

Parameters
titleView View: The view that implemented TitleViewAdapter.Provider.

showTitle

void showTitle (int flags)

Changes title view's components visibility and shows title.

Parameters
flags int: Flags representing the visibility of components inside title view.

See also:

showTitle

void showTitle (boolean show)

Shows or hides the title view.

Parameters
show boolean: True to show title view, false to hide title view.

Hooray!