Java Code Examples for android.support.v17.leanback.widget.VerticalGridView#getChildViewHolder()

The following examples show how to use android.support.v17.leanback.widget.VerticalGridView#getChildViewHolder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
/**
 * Set the visibility of titles/hovercard of browse rows.
 */
public void setExpand(boolean expand) {
    mExpand = expand;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        if (!mInTransition) ((ViewGroup) mScaleFrameLayout.getParent()).setClipChildren(!needsScale());
        updateRowScaling();
        final int count = listView.getChildCount();
        if (DEBUG) Log.v(TAG, "setExpand " + expand + " count " + count);
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder) listView.getChildViewHolder(view);
            setRowViewExpanded(vh, mExpand);
        }
    }
}
 
Example 2
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
protected void onRowSelected(ViewGroup parent, View view, int position, long id) {
    VerticalGridView listView = getVerticalGridView();
    if (listView == null) {
        return;
    }
    ItemBridgeAdapter.ViewHolder vh = (view == null) ? null :
        (ItemBridgeAdapter.ViewHolder) listView.getChildViewHolder(view);

    if (mSelectedViewHolder != vh) {
        if (DEBUG) Log.v(TAG, "new row selected position " + position + " view " + view);

        if (mSelectedViewHolder != null) {
            setRowViewSelected(mSelectedViewHolder, false, false);
        }
        mSelectedViewHolder = vh;
        if (mSelectedViewHolder != null) {
            setRowViewSelected(mSelectedViewHolder, true, false);
        }
    }
}
 
Example 3
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
/**
 * Set the visibility of titles/hovercard of browse rows.
 */
public void setExpand(boolean expand) {
    mExpand = expand;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        if (!mInTransition) ((ViewGroup) mScaleFrameLayout.getParent()).setClipChildren(!needsScale());
        updateRowScaling();
        final int count = listView.getChildCount();
        if (DEBUG) Log.v(TAG, "setExpand " + expand + " count " + count);
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder) listView.getChildViewHolder(view);
            setRowViewExpanded(vh, mExpand);
        }
    }
}
 
Example 4
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
protected void onRowSelected(ViewGroup parent, View view, int position, long id) {
    VerticalGridView listView = getVerticalGridView();
    if (listView == null) {
        return;
    }
    ItemBridgeAdapter.ViewHolder vh = (view == null) ? null :
        (ItemBridgeAdapter.ViewHolder) listView.getChildViewHolder(view);

    if (mSelectedViewHolder != vh) {
        if (DEBUG) Log.v(TAG, "new row selected position " + position + " view " + view);

        if (mSelectedViewHolder != null) {
            setRowViewSelected(mSelectedViewHolder, false, false);
        }
        mSelectedViewHolder = vh;
        if (mSelectedViewHolder != null) {
            setRowViewSelected(mSelectedViewHolder, true, false);
        }
    }
}
 
Example 5
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an item selection listener.
 * @deprecated Use {@link #setOnItemViewSelectedListener(OnItemViewSelectedListener)}
 */
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    mOnItemSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemSelectedListener(vh, mOnItemSelectedListener);
        }
    }
}
 
Example 6
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemViewSelectedListener(vh, mOnItemViewSelectedListener);
        }
    }
}
 
Example 7
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void freezeRows(boolean freeze) {
    VerticalGridView verticalView = getVerticalGridView();
    if (verticalView != null) {
        final int count = verticalView.getChildCount();
        for (int i = 0; i < count; i++) {
            ItemBridgeAdapter.ViewHolder ibvh = (ItemBridgeAdapter.ViewHolder)
                verticalView.getChildViewHolder(verticalView.getChildAt(i));
            RowPresenter rowPresenter = (RowPresenter) ibvh.getPresenter();
            RowPresenter.ViewHolder vh = rowPresenter.getRowViewHolder(ibvh.getViewHolder());
            rowPresenter.freeze(vh, freeze);
        }
    }
}
 
Example 8
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an item selection listener.
 * @deprecated Use {@link #setOnItemViewSelectedListener(OnItemViewSelectedListener)}
 */
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
    mOnItemSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemSelectedListener(vh, mOnItemSelectedListener);
        }
    }
}
 
Example 9
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemViewSelectedListener(vh, mOnItemViewSelectedListener);
        }
    }
}
 
Example 10
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
private void freezeRows(boolean freeze) {
    VerticalGridView verticalView = getVerticalGridView();
    if (verticalView != null) {
        final int count = verticalView.getChildCount();
        for (int i = 0; i < count; i++) {
            ItemBridgeAdapter.ViewHolder ibvh = (ItemBridgeAdapter.ViewHolder)
                verticalView.getChildViewHolder(verticalView.getChildAt(i));
            RowPresenter rowPresenter = (RowPresenter) ibvh.getPresenter();
            RowPresenter.ViewHolder vh = rowPresenter.getRowViewHolder(ibvh.getViewHolder());
            rowPresenter.freeze(vh, freeze);
        }
    }
}