Fields Summary |
---|
private static final String | TAG |
private static boolean | DEBUG |
private RowsFragment | mRowsFragment |
private android.support.v17.leanback.widget.ObjectAdapter | mAdapter |
private int | mContainerListAlignTop |
private android.support.v17.leanback.widget.OnItemSelectedListener | mExternalOnItemSelectedListener |
private android.support.v17.leanback.widget.OnItemClickedListener | mOnItemClickedListener |
private android.support.v17.leanback.widget.OnItemViewSelectedListener | mExternalOnItemViewSelectedListener |
private android.support.v17.leanback.widget.OnItemViewClickedListener | mOnItemViewClickedListener |
private int | mSelectedPosition |
private Object | mSceneAfterEntranceTransition |
private final SetSelectionRunnable | mSetSelectionRunnable |
Methods Summary |
---|
protected java.lang.Object | createEntranceTransition()
return sTransitionHelper.loadTransition(getActivity(),
R.transition.lb_details_enter_transition);
|
public android.support.v17.leanback.widget.ObjectAdapter | getAdapter()Returns the list of rows.
return mAdapter;
|
public android.support.v17.leanback.widget.OnItemClickedListener | getOnItemClickedListener()Returns the item Clicked listener.
return mOnItemClickedListener;
|
public android.support.v17.leanback.widget.OnItemViewClickedListener | getOnItemViewClickedListener()Returns the item Clicked listener.
return mOnItemViewClickedListener;
|
RowsFragment | getRowsFragment()
return mRowsFragment;
|
android.support.v17.leanback.widget.VerticalGridView | getVerticalGridView()
return mRowsFragment == null ? null : mRowsFragment.getVerticalGridView();
|
public void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
mContainerListAlignTop =
getResources().getDimensionPixelSize(R.dimen.lb_details_rows_align_top);
|
public android.view.View | onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
View view = inflater.inflate(R.layout.lb_details_fragment, container, false);
mRowsFragment = (RowsFragment) getChildFragmentManager().findFragmentById(
R.id.fragment_dock);
if (mRowsFragment == null) {
mRowsFragment = new RowsFragment();
getChildFragmentManager().beginTransaction()
.replace(R.id.fragment_dock, mRowsFragment).commit();
}
mRowsFragment.setAdapter(mAdapter);
mRowsFragment.setOnItemSelectedListener(mExternalOnItemSelectedListener);
mRowsFragment.setOnItemViewSelectedListener(mExternalOnItemViewSelectedListener);
mRowsFragment.setOnItemClickedListener(mOnItemClickedListener);
mRowsFragment.setOnItemViewClickedListener(mOnItemViewClickedListener);
mSceneAfterEntranceTransition = sTransitionHelper.createScene((ViewGroup) view,
new Runnable() {
@Override
public void run() {
mRowsFragment.setEntranceTransitionState(true);
}
});
return view;
|
protected void | onEntranceTransitionEnd()
mRowsFragment.onTransitionEnd();
|
public void | onStart()
super.onStart();
setupChildFragmentLayout();
mRowsFragment.getView().requestFocus();
if (isEntranceTransitionEnabled()) {
// make sure recycler view animation is disabled
mRowsFragment.onTransitionStart();
mRowsFragment.setEntranceTransitionState(false);
}
|
protected void | runEntranceTransition(java.lang.Object entranceTransition)
sTransitionHelper.runTransition(mSceneAfterEntranceTransition,
entranceTransition);
|
public void | setAdapter(android.support.v17.leanback.widget.ObjectAdapter adapter)Sets the list of rows for the fragment.
mAdapter = adapter;
if (mRowsFragment != null) {
mRowsFragment.setAdapter(adapter);
}
|
public void | setOnItemClickedListener(android.support.v17.leanback.widget.OnItemClickedListener listener)Sets an item Clicked listener.
mOnItemClickedListener = listener;
if (mRowsFragment != null) {
mRowsFragment.setOnItemClickedListener(listener);
}
|
public void | setOnItemSelectedListener(android.support.v17.leanback.widget.OnItemSelectedListener listener)Sets an item selection listener.
mExternalOnItemSelectedListener = listener;
|
public void | setOnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener listener)Sets an item Clicked listener.
mOnItemViewClickedListener = listener;
if (mRowsFragment != null) {
mRowsFragment.setOnItemViewClickedListener(listener);
}
|
public void | setOnItemViewSelectedListener(android.support.v17.leanback.widget.OnItemViewSelectedListener listener)Sets an item selection listener.
mExternalOnItemViewSelectedListener = listener;
|
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.
mSetSelectionRunnable.mPosition = position;
mSetSelectionRunnable.mSmooth = smooth;
if (getView() != null && getView().getHandler() != null) {
getView().getHandler().post(mSetSelectionRunnable);
}
|
void | setVerticalGridViewLayout(android.support.v17.leanback.widget.VerticalGridView listview)
// align the top edge of item to a fixed position
listview.setItemAlignmentOffset(0);
listview.setItemAlignmentOffsetPercent(VerticalGridView.ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
listview.setWindowAlignmentOffset(mContainerListAlignTop);
listview.setWindowAlignmentOffsetPercent(VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
listview.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
|
private void | setupChildFragmentLayout()Setup dimensions that are only meaningful when the child Fragments are inside
DetailsFragment.
setVerticalGridViewLayout(mRowsFragment.getVerticalGridView());
|