T - your model object (the object displayed by the list)public abstract class RecyclerViewPresenter<T> extends AutocompletePresenter<T>
AutocompletePresenter implementation that hosts a RecyclerView.
Supports ViewGroup.LayoutParams.WRAP_CONTENT natively.
The only contract is to
- provide a RecyclerView.Adapter in instantiateAdapter()
- call dispatchClick(Object) when an object is clicked
- update your data during AutocompletePresenter.onQuery(CharSequence)AutocompletePresenter.ClickProvider<T>, AutocompletePresenter.PopupDimensions| Constructor and Description |
|---|
RecyclerViewPresenter(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
dispatchClick(T item)
Dispatch click event to
AutocompleteCallback. |
protected void |
dispatchLayoutChange()
Request that the popup should recompute its dimensions based on a recent change in
the view being displayed.
|
protected android.support.v7.widget.RecyclerView |
getRecyclerView() |
protected android.view.ViewGroup |
getView()
Called each time the popup is shown.
|
protected abstract android.support.v7.widget.RecyclerView.Adapter |
instantiateAdapter()
Provide an adapter for the recycler.
|
protected android.support.v7.widget.RecyclerView.LayoutManager |
instantiateLayoutManager()
Provides a layout manager for the recycler.
|
protected void |
onViewHidden()
Called when the popup is hidden, to release resources.
|
protected void |
onViewShown()
Perform firther initialization here.
|
protected void |
registerClickProvider(AutocompletePresenter.ClickProvider<T> provider)
At this point the presenter is passed the
AutocompletePresenter.ClickProvider. |
protected void |
registerDataSetObserver(android.database.DataSetObserver observer)
Useful if you wish to change width/height based on content height.
|
getContext, getPopupDimensions, isShowing, onQuerypublic RecyclerViewPresenter(android.content.Context context)
protected final void registerClickProvider(AutocompletePresenter.ClickProvider<T> provider)
AutocompletePresenterAutocompletePresenter.ClickProvider.
The contract is that AutocompletePresenter.ClickProvider.click(Object) must be called when a list item
is clicked. This ensure that the autocomplete callback will receive the event.registerClickProvider in class AutocompletePresenter<T>provider - a click provider for this presenter.protected final void registerDataSetObserver(android.database.DataSetObserver observer)
AutocompletePresenterDataSetObserver.onChanged() when your view has
changes.
This is called after AutocompletePresenter.getView().registerDataSetObserver in class AutocompletePresenter<T>observer - the observer.@CallSuper protected android.view.ViewGroup getView()
AutocompletePresenterAutocompletePresenter.getContext().getView in class AutocompletePresenter<T>protected void onViewShown()
AutocompletePresenterAutocompletePresenter.getView(),
each time the popup is shown.onViewShown in class AutocompletePresenter<T>@CallSuper protected void onViewHidden()
AutocompletePresenteronViewHidden in class AutocompletePresenter<T>@Nullable protected final android.support.v7.widget.RecyclerView getRecyclerView()
protected final void dispatchClick(T item)
AutocompleteCallback.
Should be called when items are clicked.item - the clicked item.protected final void dispatchLayoutChange()
RecyclerView events.
Only use it for changes in other views that you have added to the popup,
and only if one of the dimensions for the popup is WRAP_CONTENT .protected abstract android.support.v7.widget.RecyclerView.Adapter instantiateAdapter()
protected android.support.v7.widget.RecyclerView.LayoutManager instantiateLayoutManager()