Methods Summary |
---|
android.support.v17.leanback.widget.VerticalGridView | findGridViewFromRoot(android.view.View view)
return (VerticalGridView) view;
|
public final android.support.v17.leanback.widget.ObjectAdapter | getAdapter()Returns the list of rows.
return mAdapter;
|
final android.support.v17.leanback.widget.ItemBridgeAdapter | getBridgeAdapter()Returns the bridge adapter.
return mBridgeAdapter;
|
java.lang.Object | getItem(android.support.v17.leanback.widget.Row row, int position)
if (row instanceof ListRow) {
return ((ListRow) row).getAdapter().get(position);
} else {
return null;
}
|
abstract int | getLayoutResourceId()
|
public final android.support.v17.leanback.widget.PresenterSelector | getPresenterSelector()Get the presenter selector used to create and bind views.
return mPresenterSelector;
|
final android.support.v17.leanback.widget.VerticalGridView | getVerticalGridView()
return mVerticalGridView;
|
public android.view.View | onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
View view = inflater.inflate(getLayoutResourceId(), container, false);
mVerticalGridView = findGridViewFromRoot(view);
return view;
|
public void | onDestroyView()
super.onDestroyView();
mVerticalGridView = null;
|
void | onRowSelected(android.view.ViewGroup parent, android.view.View view, int position, long id)
|
void | onTransitionEnd()
if (mVerticalGridView != null) {
mVerticalGridView.setAnimateChildLayout(true);
mVerticalGridView.setPruneChild(true);
mVerticalGridView.setFocusSearchDisabled(false);
}
|
void | onTransitionStart()
if (mVerticalGridView != null) {
mVerticalGridView.setAnimateChildLayout(false);
mVerticalGridView.setPruneChild(false);
mVerticalGridView.setFocusSearchDisabled(true);
}
|
public void | onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
if (mBridgeAdapter != null) {
mVerticalGridView.setAdapter(mBridgeAdapter);
if (mSelectedPosition != -1) {
mVerticalGridView.setSelectedPosition(mSelectedPosition);
}
}
mVerticalGridView.setOnChildSelectedListener(mRowSelectedListener);
|
public final void | setAdapter(android.support.v17.leanback.widget.ObjectAdapter rowsAdapter)Sets the adapter for the fragment.
mAdapter = rowsAdapter;
updateAdapter();
|
void | setItemAlignment()
if (mVerticalGridView != null) {
// align the top edge of item
mVerticalGridView.setItemAlignmentOffset(0);
mVerticalGridView.setItemAlignmentOffsetPercent(
VerticalGridView.ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
}
|
public final void | setPresenterSelector(android.support.v17.leanback.widget.PresenterSelector presenterSelector)Set the presenter selector used to create and bind views.
mPresenterSelector = presenterSelector;
updateAdapter();
|
public void | setSelectedPosition(int position)Sets the selected row position with smooth animation.
setSelectedPosition(position, true);
|
public void | setSelectedPosition(int position, boolean smooth)Sets the selected row position.
mSelectedPosition = position;
if(mVerticalGridView != null && mVerticalGridView.getAdapter() != null) {
if (smooth) {
mVerticalGridView.setSelectedPositionSmooth(position);
} else {
mVerticalGridView.setSelectedPosition(position);
}
}
|
void | setWindowAlignmentFromTop(int alignedTop)
if (mVerticalGridView != null) {
// align to a fixed position from top
mVerticalGridView.setWindowAlignmentOffset(alignedTop);
mVerticalGridView.setWindowAlignmentOffsetPercent(
VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
mVerticalGridView.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
}
|
void | updateAdapter()
mBridgeAdapter = null;
if (mAdapter != null) {
// If presenter selector is null, adapter ps will be used
mBridgeAdapter = new ItemBridgeAdapter(mAdapter, mPresenterSelector);
}
if (mVerticalGridView != null) {
mVerticalGridView.setAdapter(mBridgeAdapter);
if (mBridgeAdapter != null && mSelectedPosition != -1) {
mVerticalGridView.setSelectedPosition(mSelectedPosition);
}
}
|