public abstract class TitleViewAdapter extends Object
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.Modifier and Type | Class and Description |
---|---|
static interface |
TitleViewAdapter.Provider
Interface to be implemented by a customized widget class to implement
TitleViewAdapter . |
Modifier and Type | Field and Description |
---|---|
static int |
BRANDING_VIEW_VISIBLE |
static int |
FULL_VIEW_VISIBLE |
static int |
SEARCH_VIEW_VISIBLE |
Constructor and Description |
---|
TitleViewAdapter() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int BRANDING_VIEW_VISIBLE
public static final int SEARCH_VIEW_VISIBLE
public static final int FULL_VIEW_VISIBLE
public void setTitle(CharSequence titleText)
titleText
- The text to set as title.public CharSequence getTitle()
public void setBadgeDrawable(Drawable drawable)
drawable
- The badge drawable to set on title view.public Drawable getBadgeDrawable()
public abstract View getSearchAffordanceView()
public void setOnSearchClickedListener(View.OnClickListener listener)
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.
listener
- The listener to call when the search element is clicked.public void setSearchAffordanceColors(SearchOrbView.Colors colors)
SearchOrbView.Colors
used to draw the
search affordance.colors
- Colors used to draw search affordance.public SearchOrbView.Colors getSearchAffordanceColors()
SearchOrbView.Colors
used to draw the
search affordance.public void setAnimationEnabled(boolean enable)
enable
- True to enable animation, false otherwise.public void updateComponentsVisibility(int flags)
flags
- integer representing the visibility of TitleView components.BRANDING_VIEW_VISIBLE
,
SEARCH_VIEW_VISIBLE
,
FULL_VIEW_VISIBLE