added in version 24.1.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

TitleViewAdapter

public abstract class TitleViewAdapter
extends Object

java.lang.Object
   ↳ android.support.v17.leanback.widget.TitleViewAdapter


This class allows a customized widget class to implement TitleViewAdapter.Provider and expose TitleViewAdapter methods to containing fragment (e.g. BrowseFragment or DetailsFragment). The title view must have a search orb view (getSearchAffordanceView() aligned to start and can typically have a branding Drawable and or title text aligned to end. The branding part is fully open to customization: not necessary to be a drawable or text.

Summary

Nested classes

interface TitleViewAdapter.Provider

Interface to be implemented by a customized widget class to implement TitleViewAdapter

Constants

int BRANDING_VIEW_VISIBLE

int FULL_VIEW_VISIBLE

int SEARCH_VIEW_VISIBLE

Public constructors

TitleViewAdapter()

Public methods

Drawable getBadgeDrawable()

Returns the badge drawable.

SearchOrbView.Colors getSearchAffordanceColors()

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

abstract View getSearchAffordanceView()

Returns the view for the search affordance.

CharSequence getTitle()

Returns the title text.

void setAnimationEnabled(boolean enable)

Enables or disables any view animations.

void setBadgeDrawable(Drawable drawable)

Sets the badge drawable.

void setOnSearchClickedListener(View.OnClickListener listener)

Sets a click listener for the search affordance view.

void setSearchAffordanceColors(SearchOrbView.Colors colors)

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

void setTitle(CharSequence titleText)

Sets the title text.

void updateComponentsVisibility(int flags)

Based on the flag, it updates the visibility of the individual components - Branding views (badge drawable and/or title) and search affordance view.

Inherited methods

From class java.lang.Object

Constants

BRANDING_VIEW_VISIBLE

added in version 24.1.0
int BRANDING_VIEW_VISIBLE

Constant Value: 2 (0x00000002)

FULL_VIEW_VISIBLE

added in version 24.1.0
int FULL_VIEW_VISIBLE

Constant Value: 6 (0x00000006)

SEARCH_VIEW_VISIBLE

added in version 24.1.0
int SEARCH_VIEW_VISIBLE

Constant Value: 4 (0x00000004)

Public constructors

TitleViewAdapter

added in version 24.1.0
TitleViewAdapter ()

Public methods

getBadgeDrawable

added in version 24.1.0
Drawable getBadgeDrawable ()

Returns the badge drawable.

Returns
Drawable The badge drawable.

getSearchAffordanceColors

added in version 24.1.0
SearchOrbView.Colors getSearchAffordanceColors ()

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

Returns
SearchOrbView.Colors Colors used to draw search affordance.

getSearchAffordanceView

added in version 24.1.0
View getSearchAffordanceView ()

Returns the view for the search affordance.

Returns
View The view for search affordance.

getTitle

added in version 24.1.0
CharSequence getTitle ()

Returns the title text.

Returns
CharSequence The title text.

setAnimationEnabled

added in version 24.1.0
void setAnimationEnabled (boolean enable)

Enables or disables any view animations. This method is called to save CPU cycle for example stop search view breathing animation when containing fragment is paused.

Parameters
enable boolean: True to enable animation, false otherwise.

setBadgeDrawable

added in version 24.1.0
void setBadgeDrawable (Drawable drawable)

Sets the badge drawable. If non-null, the drawable is displayed instead of the title text.

Parameters
drawable Drawable: The badge drawable to set on title view.

setOnSearchClickedListener

added in version 24.1.0
void setOnSearchClickedListener (View.OnClickListener listener)

Sets a click listener for the search affordance view.

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.

setSearchAffordanceColors

added in version 24.1.0
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 24.1.0
void setTitle (CharSequence titleText)

Sets the title text.

Parameters
titleText CharSequence: The text to set as title.

updateComponentsVisibility

added in version 24.1.0
void updateComponentsVisibility (int flags)

Based on the flag, it updates the visibility of the individual components - Branding views (badge drawable and/or title) and search affordance view.

Parameters
flags int: integer representing the visibility of TitleView components.