PresenterSwitcher

abstract class PresenterSwitcher
kotlin.Any
   ↳ androidx.leanback.widget.PresenterSwitcher

An abstract helper class that switches a view in its parent view using a PresenterSelector. A subclass should implement insertView(View) to define how to add the view in parent, and may optionally override onViewSelected(View).

Summary

Public constructors

An abstract helper class that switches a view in its parent view using a PresenterSelector.

Public methods

open Unit

Destroys created views.

ViewGroup!

Returns the parent.

open Unit
init(parent: ViewGroup!, presenterSelector: PresenterSelector!)

Initializes the switcher with a parent view to insert view into and a PresenterSelector for choosing a Presenter for a given object.

open Unit
select(object: Any!)

Selects a view based on the given object and shows that view.

open Unit

Hides the view.

Protected methods

abstract Unit
insertView(view: View!)

open Unit

Called when a view is bound to the object of select(Object).

open Unit
showView(view: View!, visible: Boolean)

Public constructors

<init>

PresenterSwitcher()

An abstract helper class that switches a view in its parent view using a PresenterSelector. A subclass should implement insertView(View) to define how to add the view in parent, and may optionally override onViewSelected(View).

Public methods

clear

open fun clear(): Unit

Destroys created views.

getParentViewGroup

fun getParentViewGroup(): ViewGroup!

Returns the parent.

init

open fun init(parent: ViewGroup!, presenterSelector: PresenterSelector!): Unit

Initializes the switcher with a parent view to insert view into and a PresenterSelector for choosing a Presenter for a given object. This will destroy any existing views.

select

open fun select(object: Any!): Unit

Selects a view based on the given object and shows that view.

unselect

open fun unselect(): Unit

Hides the view.

Protected methods

insertView

protected abstract fun insertView(view: View!): Unit

onViewSelected

protected open fun onViewSelected(view: View!): Unit

Called when a view is bound to the object of select(Object).

showView

protected open fun showView(view: View!, visible: Boolean): Unit