Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

BrandedFragment

open class BrandedFragment : Fragment
kotlin.Any
   ↳ android.app.Fragment
   ↳ androidx.leanback.app.BrandedFragment

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

Summary

Public constructors

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

Public methods

open Drawable!

Returns the badge drawable used in the fragment title.

open Int

Returns the color used to draw the search affordance.

open SearchOrbView.Colors!

Returns the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

open CharSequence!

Returns the title text for the fragment.

open View!

Returns the view that implements TitleViewAdapter.Provider.

open TitleViewAdapter!

Returns the TitleViewAdapter implemented by title view.

open Unit
installTitleView(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!)

Inflate title view and add to parent.

Boolean

Returns true/false to indicate the visibility of TitleView.

open Unit

open View!
onInflateTitleView(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!)

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

open Unit

open Unit

open Unit

open Unit

open Unit
onViewCreated(@NonNull view: View, @Nullable savedInstanceState: Bundle?)

open Unit

Sets the drawable displayed in the fragment title.

open Unit

Sets a click listener for the search affordance.

open Unit

Sets the color used to draw the search affordance.

open Unit

Sets the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

open Unit

Sets title text for the fragment.

open Unit
setTitleView(titleView: View!)

Sets the view that implemented TitleViewAdapter.

open Unit

Shows or hides the title view.

open Unit
showTitle(flags: Int)

Changes title view's components visibility and shows title.

Public constructors

<init>

BrandedFragment()

Deprecated: use BrandedSupportFragment

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

Public methods

getBadgeDrawable

open fun getBadgeDrawable(): Drawable!

Returns the badge drawable used in the fragment title.

Return
Drawable!: The badge drawable used in the fragment title.

getSearchAffordanceColor

open fun getSearchAffordanceColor(): Int

Returns the color used to draw the search affordance.

getSearchAffordanceColors

open fun getSearchAffordanceColors(): SearchOrbView.Colors!

Returns the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

getTitle

open fun getTitle(): CharSequence!

Returns the title text for the fragment.

Return
CharSequence!: Title text for the fragment.

getTitleView

open fun getTitleView(): View!

Returns the view that implements TitleViewAdapter.Provider.

Return
View!: The view that implements TitleViewAdapter.Provider.

getTitleViewAdapter

open fun getTitleViewAdapter(): TitleViewAdapter!

Returns the TitleViewAdapter implemented by title view.

Return
TitleViewAdapter!: The TitleViewAdapter implemented by title view.

installTitleView

open fun installTitleView(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!): Unit

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 LayoutInflater!: Parent of title view.
savedInstanceState LayoutInflater!: If non-null, this fragment is being re-constructed from a previous saved state as given here.

isShowingTitle

fun isShowingTitle(): Boolean

Returns true/false to indicate the visibility of TitleView.

Return
Boolean: boolean to indicate whether or not it's showing the title.

onDestroyView

open fun onDestroyView(): Unit

onInflateTitleView

open fun onInflateTitleView(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!): View!

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 LayoutInflater!: Parent of title view.
savedInstanceState LayoutInflater!: If non-null, this fragment is being re-constructed from a previous saved state as given here.
Return
View!: Title view which must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider, or null for no title view.

onPause

open fun onPause(): Unit

onResume

open fun onResume(): Unit

onSaveInstanceState

open fun onSaveInstanceState(outState: Bundle!): Unit

onStart

open fun onStart(): Unit

onViewCreated

open fun onViewCreated(@NonNull view: View, @Nullable savedInstanceState: Bundle?): Unit

setBadgeDrawable

open fun setBadgeDrawable(drawable: Drawable!): Unit

Sets the drawable displayed in the fragment title.

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

setOnSearchClickedListener

open fun setOnSearchClickedListener(listener: OnClickListener!): Unit

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 OnClickListener!: The listener to call when the search element is clicked.

setSearchAffordanceColor

open fun setSearchAffordanceColor(color: Int): Unit

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

open fun setSearchAffordanceColors(colors: SearchOrbView.Colors!): Unit

Sets the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

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

setTitle

open fun setTitle(title: CharSequence!): Unit

Sets title text for the fragment.

Parameters
title CharSequence!: The title text of the fragment.

setTitleView

open fun setTitleView(titleView: View!): Unit

Sets the view that implemented TitleViewAdapter.

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

showTitle

open fun showTitle(show: Boolean): Unit

Shows or hides the title view.

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

showTitle

open fun showTitle(flags: Int): Unit

Changes title view's components visibility and shows title.

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