Methods Summary |
---|
android.support.v17.leanback.widget.VerticalGridView | findGridViewFromRoot(android.view.View view)
return (VerticalGridView) view.findViewById(R.id.browse_headers);
|
int | getBackgroundColor()
if (getActivity() == null) {
throw new IllegalStateException("Activity must be attached");
}
if (mBackgroundColorSet) {
return mBackgroundColor;
}
TypedValue outValue = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.defaultBrandColor, outValue, true);
return getResources().getColor(outValue.resourceId);
|
int | getLayoutResourceId()
return R.layout.lb_headers_fragment;
|
void | onRowSelected(android.view.ViewGroup parent, android.view.View view, int position, long id)
if (mOnItemSelectedListener != null) {
if (position >= 0) {
Row row = (Row) getAdapter().get(position);
mOnItemSelectedListener.onItemSelected(null, row);
} else {
mOnItemSelectedListener.onItemSelected(null, null);
}
}
|
void | onTransitionEnd()
if (mHeadersEnabled) {
final VerticalGridView listView = getVerticalGridView();
if (listView != null) {
listView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
if (listView.hasFocus()) {
listView.requestFocus();
}
}
}
super.onTransitionEnd();
|
void | onTransitionStart()
super.onTransitionStart();
if (!mHeadersEnabled) {
// When enabling headers fragment, the RowHeaderView gets a focus but
// isShown() is still false because its parent is INVSIBILE, accessibility
// event is not sent.
// Workaround is: prevent focus to a child view during transition and put
// focus on it after transition is done.
final VerticalGridView listView = getVerticalGridView();
if (listView != null) {
listView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
if (listView.hasFocus()) {
listView.requestFocus();
}
}
}
|
public void | onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
super.onViewCreated(view, savedInstanceState);
final VerticalGridView listView = getVerticalGridView();
if (listView == null) {
return;
}
if (getBridgeAdapter() != null) {
FocusHighlightHelper.setupHeaderItemFocusHighlight(listView);
}
view.setBackgroundColor(getBackgroundColor());
updateFadingEdgeToBrandColor(getBackgroundColor());
updateListViewVisibility();
|
void | setBackgroundColor(int color)
mBackgroundColor = color;
mBackgroundColorSet = true;
if (getView() != null) {
getView().setBackgroundColor(mBackgroundColor);
updateFadingEdgeToBrandColor(mBackgroundColor);
}
|
void | setHeadersEnabled(boolean enabled)
mHeadersEnabled = enabled;
updateListViewVisibility();
|
void | setHeadersGone(boolean gone)
mHeadersGone = gone;
updateListViewVisibility();
|
public void | setOnHeaderClickedListener(android.support.v17.leanback.app.HeadersFragment$OnHeaderClickedListener listener)
mOnHeaderClickedListener = listener;
|
public void | setOnItemSelectedListener(android.support.v17.leanback.widget.OnItemSelectedListener listener)
mOnItemSelectedListener = listener;
|
void | updateAdapter()
super.updateAdapter();
ItemBridgeAdapter adapter = getBridgeAdapter();
if (adapter != null) {
adapter.setAdapterListener(mAdapterListener);
adapter.setWrapper(mWrapper);
}
if (adapter != null && getVerticalGridView() != null) {
FocusHighlightHelper.setupHeaderItemFocusHighlight(getVerticalGridView());
}
|
private void | updateFadingEdgeToBrandColor(int backgroundColor)
View fadingView = getView().findViewById(R.id.fade_out_edge);
Drawable background = fadingView.getBackground();
if (background instanceof GradientDrawable) {
background.mutate();
((GradientDrawable) background).setColors(
new int[] {Color.TRANSPARENT, backgroundColor});
}
|
private void | updateListViewVisibility()
final VerticalGridView listView = getVerticalGridView();
if (listView != null) {
getView().setVisibility(mHeadersGone ? View.GONE : View.VISIBLE);
if (!mHeadersGone) {
if (mHeadersEnabled) {
listView.setChildrenVisibility(View.VISIBLE);
} else {
listView.setChildrenVisibility(View.INVISIBLE);
}
}
}
|