added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0-beta01
Deprecated since version 1.0.0

BrandedFragment

public class BrandedFragment
extends Fragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ androidx.leanback.app.BrandedFragment


This class was deprecated in API level 1.0.0.
use BrandedSupportFragment

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

Summary

Inherited constants

Public constructors

BrandedFragment()

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()
View onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)

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

void onPause()
void onResume()
void onSaveInstanceState(Bundle outState)
void onStart()
void onViewCreated(View view, Bundle savedInstanceState)
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

Public constructors

BrandedFragment

added in version 1.0.0
public BrandedFragment ()

Public methods

getBadgeDrawable

added in version 1.0.0
public Drawable getBadgeDrawable ()

Returns the badge drawable used in the fragment title.

Returns
Drawable The badge drawable used in the fragment title.

getSearchAffordanceColor

added in version 1.0.0
public int getSearchAffordanceColor ()

Returns the color used to draw the search affordance.

Returns
int

getSearchAffordanceColors

added in version 1.0.0
public SearchOrbView.Colors getSearchAffordanceColors ()

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

Returns
SearchOrbView.Colors

getTitle

added in version 1.0.0
public CharSequence getTitle ()

Returns the title text for the fragment.

Returns
CharSequence Title text for the fragment.

getTitleView

added in version 1.0.0
public View getTitleView ()

Returns the view that implements TitleViewAdapter.Provider.

Returns
View The view that implements TitleViewAdapter.Provider.

getTitleViewAdapter

added in version 1.0.0
public TitleViewAdapter getTitleViewAdapter ()

Returns the TitleViewAdapter implemented by title view.

Returns
TitleViewAdapter The TitleViewAdapter implemented by title view.

installTitleView

added in version 1.0.0
public void installTitleView (LayoutInflater inflater, 
                ViewGroup parent, 
                Bundle savedInstanceState)

Inflate title view and add to parent. This method should be called in Fragment.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

added in version 1.0.0
public final 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

public void onDestroyView ()

onInflateTitleView

added in version 1.0.0
public 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

public void onPause ()

onResume

public void onResume ()

onSaveInstanceState

public void onSaveInstanceState (Bundle outState)

Parameters
outState Bundle

onStart

public void onStart ()

onViewCreated

public void onViewCreated (View view, 
                Bundle savedInstanceState)

Parameters
view View

savedInstanceState Bundle

setBadgeDrawable

added in version 1.0.0
public void setBadgeDrawable (Drawable drawable)

Sets the drawable displayed in the fragment title.

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

setOnSearchClickedListener

added in version 1.0.0
public 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

added in version 1.0.0
public 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

added in version 1.0.0
public 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

added in version 1.0.0
public void setTitle (CharSequence title)

Sets title text for the fragment.

Parameters
title CharSequence: The title text of the fragment.

setTitleView

added in version 1.0.0
public void setTitleView (View titleView)

Sets the view that implemented TitleViewAdapter.

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

showTitle

added in version 1.0.0
public 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.

showTitle

added in version 1.0.0
public void showTitle (boolean show)

Shows or hides the title view.

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