Methods Summary |
---|
public void | clear()
setAdapter(null);
|
public int | getItemCount()
return mAdapter.size();
|
public long | getItemId(int position)
return mAdapter.getId(position);
|
public int | getItemViewType(int position)
PresenterSelector presenterSelector = mPresenterSelector != null ?
mPresenterSelector : mAdapter.getPresenterSelector();
Object item = mAdapter.get(position);
Presenter presenter = presenterSelector.getPresenter(item);
int type = mPresenters.indexOf(presenter);
if (type < 0) {
mPresenters.add(presenter);
type = mPresenters.indexOf(presenter);
if (DEBUG) Log.v(TAG, "getItemViewType added presenter " + presenter + " type " + type);
if (mAdapterListener != null) {
mAdapterListener.onAddPresenter(presenter, type);
}
}
return type;
|
public java.util.ArrayList | getPresenterMapper()
return mPresenters;
|
public android.support.v17.leanback.widget.ItemBridgeAdapter$Wrapper | getWrapper()
return mWrapper;
|
public void | onBindViewHolder(RecyclerView.ViewHolder holder, int position)
if (DEBUG) Log.v(TAG, "onBindViewHolder position " + position);
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.mItem = mAdapter.get(position);
viewHolder.mPresenter.onBindViewHolder(viewHolder.mHolder, viewHolder.mItem);
if (mAdapterListener != null) {
mAdapterListener.onBind(viewHolder);
}
|
public RecyclerView.ViewHolder | onCreateViewHolder(android.view.ViewGroup parent, int viewType){@link View.OnFocusChangeListener} that assigned in
{@link Presenter#onCreateViewHolder(ViewGroup)} may be chained, user should never change
{@link View.OnFocusChangeListener} after that.
if (DEBUG) Log.v(TAG, "onCreateViewHolder viewType " + viewType);
Presenter presenter = mPresenters.get(viewType);
Presenter.ViewHolder presenterVh;
View view;
if (mWrapper != null) {
view = mWrapper.createWrapper(parent);
presenterVh = presenter.onCreateViewHolder(parent);
mWrapper.wrap(view, presenterVh.view);
} else {
presenterVh = presenter.onCreateViewHolder(parent);
view = presenterVh.view;
}
ViewHolder viewHolder = new ViewHolder(presenter, view, presenterVh);
if (mAdapterListener != null) {
mAdapterListener.onCreate(viewHolder);
}
View presenterView = viewHolder.mHolder.view;
if (presenterView != null) {
viewHolder.mFocusChangeListener.mChainedListener = presenterView.getOnFocusChangeListener();
presenterView.setOnFocusChangeListener(viewHolder.mFocusChangeListener);
}
if (mFocusHighlight != null) {
mFocusHighlight.onInitializeView(view);
}
return viewHolder;
|
public void | onViewAttachedToWindow(RecyclerView.ViewHolder holder)
ViewHolder viewHolder = (ViewHolder) holder;
if (mAdapterListener != null) {
mAdapterListener.onAttachedToWindow(viewHolder);
}
viewHolder.mPresenter.onViewAttachedToWindow(viewHolder.mHolder);
|
public void | onViewDetachedFromWindow(RecyclerView.ViewHolder holder)
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.mPresenter.onViewDetachedFromWindow(viewHolder.mHolder);
if (mAdapterListener != null) {
mAdapterListener.onDetachedFromWindow(viewHolder);
}
|
public void | onViewRecycled(RecyclerView.ViewHolder holder)
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.mPresenter.onUnbindViewHolder(viewHolder.mHolder);
viewHolder.mItem = null;
if (mAdapterListener != null) {
mAdapterListener.onUnbind(viewHolder);
}
|
public void | setAdapter(ObjectAdapter adapter)
if (mAdapter != null) {
mAdapter.unregisterObserver(mDataObserver);
}
mAdapter = adapter;
if (mAdapter == null) {
return;
}
mAdapter.registerObserver(mDataObserver);
if (hasStableIds() != mAdapter.hasStableIds()) {
setHasStableIds(mAdapter.hasStableIds());
}
|
public void | setAdapterListener(android.support.v17.leanback.widget.ItemBridgeAdapter$AdapterListener listener)
mAdapterListener = listener;
|
void | setFocusHighlight(FocusHighlightHandler listener)
mFocusHighlight = listener;
if (DEBUG) Log.v(TAG, "setFocusHighlight " + mFocusHighlight);
|
public void | setPresenterMapper(java.util.ArrayList presenters)
mPresenters = presenters;
|
public void | setWrapper(android.support.v17.leanback.widget.ItemBridgeAdapter$Wrapper wrapper)
mWrapper = wrapper;
|