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

The following examples show how to use android.support.v17.leanback.widget.VerticalGridView#setWindowAlignment() . 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: PlaybackOverlaySupportFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
void setVerticalGridViewLayout(VerticalGridView listview) {
    if (listview == null) {
        return;
    }
    // Padding affects alignment when last row is focused
    // (last is first when there's only one row).
    setBottomPadding(listview, mPaddingBottom);

    // Item alignment affects focused row that isn't the last.
    listview.setItemAlignmentOffset(mAlignPosition);
    listview.setItemAlignmentOffsetPercent(100);

    // Push rows to the bottom.
    listview.setWindowAlignmentOffset(0);
    listview.setWindowAlignmentOffsetPercent(100);
    listview.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_HIGH_EDGE);
}
 
Example 2
Source File: PlaybackOverlayFragment.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
void setVerticalGridViewLayout(VerticalGridView listview) {
    if (listview == null) {
        return;
    }
    // Padding affects alignment when last row is focused
    // (last is first when there's only one row).
    setBottomPadding(listview, mPaddingBottom);

    // Item alignment affects focused row that isn't the last.
    listview.setItemAlignmentOffset(mAlignPosition);
    listview.setItemAlignmentOffsetPercent(100);

    // Push rows to the bottom.
    listview.setWindowAlignmentOffset(0);
    listview.setWindowAlignmentOffsetPercent(100);
    listview.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_HIGH_EDGE);
}
 
Example 3
Source File: DetailsFragment.java    From iview-android-tv with MIT License 5 votes vote down vote up
private void setupGridAlignment(VerticalGridView grid) {
    int cardHeight = getResources().getDimensionPixelSize(R.dimen.card_height);
    int titleHeight = getResources().getDimensionPixelSize(R.dimen.lb_browse_header_height);
    grid.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_LOW_EDGE);
    grid.setWindowAlignmentOffset(cardHeight + titleHeight);
    grid.setWindowAlignmentOffsetPercent(VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);

    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) grid.getLayoutParams();
    lp.topMargin = mHeaderHeight;
    grid.setLayoutParams(lp);
}
 
Example 4
Source File: SearchSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();

    VerticalGridView list = mRowsSupportFragment.getVerticalGridView();
    int mContainerListAlignTop =
            getResources().getDimensionPixelSize(R.dimen.lb_search_browse_rows_align_top);
    list.setItemAlignmentOffset(0);
    list.setItemAlignmentOffsetPercent(VerticalGridView.ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
    list.setWindowAlignmentOffset(mContainerListAlignTop);
    list.setWindowAlignmentOffsetPercent(VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
    list.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
}
 
Example 5
Source File: RowsSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
void setWindowAlignmentFromTop(int alignedTop) {
    mAlignedTop = alignedTop;
    final VerticalGridView gridView = getVerticalGridView();
    if (gridView != null) {
        updateWindowAlignOffset();
        // align to a fixed position from top
        gridView.setWindowAlignmentOffsetPercent(
                VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
        gridView.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
    }
}
 
Example 6
Source File: DetailsSupportFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
void setVerticalGridViewLayout(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);
}
 
Example 7
Source File: DetailsFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
void setVerticalGridViewLayout(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);
}
 
Example 8
Source File: RowsFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
void setWindowAlignmentFromTop(int alignedTop) {
    mAlignedTop = alignedTop;
    final VerticalGridView gridView = getVerticalGridView();
    if (gridView != null) {
        updateWindowAlignOffset();
        // align to a fixed position from top
        gridView.setWindowAlignmentOffsetPercent(
                VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
        gridView.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
    }
}
 
Example 9
Source File: SearchFragment.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();

    VerticalGridView list = mRowsFragment.getVerticalGridView();
    int mContainerListAlignTop =
            getResources().getDimensionPixelSize(R.dimen.lb_search_browse_rows_align_top);
    list.setItemAlignmentOffset(0);
    list.setItemAlignmentOffsetPercent(VerticalGridView.ITEM_ALIGN_OFFSET_PERCENT_DISABLED);
    list.setWindowAlignmentOffset(mContainerListAlignTop);
    list.setWindowAlignmentOffsetPercent(VerticalGridView.WINDOW_ALIGN_OFFSET_PERCENT_DISABLED);
    list.setWindowAlignment(VerticalGridView.WINDOW_ALIGN_NO_EDGE);
}