Stay organized with collections Save and categorize content based on your preferences.

PresenterSwitcher

public abstract class PresenterSwitcher

Known direct subclasses
HorizontalHoverCardSwitcher

A helper class for showing a hover card view below a HorizontalGridView.


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

Summary

Public constructors

Public methods

void

Destroys created views.

final ViewGroup

Returns the parent.

void
init(ViewGroup parent, PresenterSelector presenterSelector)

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

void
select(Object object)

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

void

Hides the view.

Protected methods

abstract void
void

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

void
showView(View view, boolean visible)

Public constructors

PresenterSwitcher

public PresenterSwitcher()

Public methods

clear

public void clear()

Destroys created views.

getParentViewGroup

public final ViewGroup getParentViewGroup()

Returns the parent.

init

public void init(ViewGroup parent, PresenterSelector presenterSelector)

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

public void select(Object object)

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

unselect

public void unselect()

Hides the view.

Protected methods

insertView

protected abstract void insertView(View view)

onViewSelected

protected void onViewSelected(View view)

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

showView

protected void showView(View view, boolean visible)