Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
Android 0.0.0 Developer Preview
belongs to Maven artifact androidx.leanback:leanback:1.1.0-alpha01
Deprecated since version 0.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 0.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

public BrandedFragment ()

Public methods

getBadgeDrawable

public Drawable getBadgeDrawable ()

Returns the badge drawable used in the fragment title.

Returns
Drawable The badge drawable used in the fragment title.

getSearchAffordanceColor

public int getSearchAffordanceColor ()

Returns the color used to draw the search affordance.

Returns
int

getSearchAffordanceColors

public SearchOrbView.Colors getSearchAffordanceColors ()

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

Returns
SearchOrbView.Colors

getTitle

public CharSequence getTitle ()

Returns the title text for the fragment.

Returns
CharSequence Title text for the fragment.

getTitleView

public View getTitleView ()

Returns the view that implements TitleViewAdapter.Provider.

Returns
View The view that implements TitleViewAdapter.Provider.

getTitleViewAdapter

public TitleViewAdapter getTitleViewAdapter ()

Returns the TitleViewAdapter implemented by title view.

Returns
TitleViewAdapter The TitleViewAdapter implemented by title view.

installTitleView

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

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

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

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

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

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

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

public void setTitle (CharSequence title)

Sets title text for the fragment.

Parameters
title CharSequence: The title text of the fragment.

setTitleView

public void setTitleView (View titleView)

Sets the view that implemented TitleViewAdapter.

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

showTitle

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

public void showTitle (boolean show)

Shows or hides the title view.

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