@Test public void prefetchChildItemsBeforeAttach() throws Throwable { SingleSupportFragmentTestActivity activity = launchAndWaitActivity(F_ListRowWithOnClick.class, 1000); F_ListRowWithOnClick fragment = (F_ListRowWithOnClick) activity.getTestFragment(); final VerticalGridView gridView = fragment.getVerticalGridView(); View lastRow = gridView.getChildAt(gridView.getChildCount() - 1); final int lastRowPos = gridView.getChildAdapterPosition(lastRow); InstrumentationRegistry.getInstrumentation().runOnMainSync( new Runnable() { public void run() { gridView.setSelectedPositionSmooth(lastRowPos); } } ); waitForScrollIdle(gridView); ItemBridgeAdapter.ViewHolder prefetchedBridgeVh = (ItemBridgeAdapter.ViewHolder) gridView.findViewHolderForAdapterPosition(lastRowPos + 1); RowPresenter prefetchedRowPresenter = (RowPresenter) prefetchedBridgeVh.getPresenter(); final ListRowPresenter.ViewHolder prefetchedListRowVh = (ListRowPresenter.ViewHolder) prefetchedRowPresenter.getRowViewHolder(prefetchedBridgeVh.getViewHolder()); fragment.mLastClickedItemViewHolder = null; InstrumentationRegistry.getInstrumentation().runOnMainSync( new Runnable() { public void run() { prefetchedListRowVh.getItemViewHolder(0).view.performClick(); } } ); assertSame(prefetchedListRowVh.getItemViewHolder(0), fragment.mLastClickedItemViewHolder); }
public RowPresenter.ViewHolder getRowViewHolder(int position) { VerticalGridView verticalView = getVerticalGridView(); if (verticalView == null) { return null; } return getRowViewHolder((ItemBridgeAdapter.ViewHolder) verticalView.findViewHolderForAdapterPosition(position)); }
RowsSupportFragment extends BaseRowSupportFragment implements
        BrowseSupportFragment.MainFragmentRowsAdapterProvider,
        BrowseSupportFragment.MainFragmentAdapterProvider { public RowPresenter.ViewHolder getRowViewHolder(int position) { VerticalGridView verticalView = getVerticalGridView(); if (verticalView == null) { return null; } return getRowViewHolder((ItemBridgeAdapter.ViewHolder) verticalView.findViewHolderForAdapterPosition(position)); } }
RowsSupportFragment extends BaseRowSupportFragment implements
        BrowseSupportFragment.MainFragmentRowsAdapterProvider,
        BrowseSupportFragment.MainFragmentAdapterProvider { public RowPresenter.ViewHolder getRowViewHolder(int position) { VerticalGridView verticalView = getVerticalGridView(); if (verticalView == null) { return null; } return getRowViewHolder((ItemBridgeAdapter.ViewHolder) verticalView.findViewHolderForAdapterPosition(position)); }  }
RowsSupportFragment extends BaseRowSupportFragment implements
        BrowseSupportFragment.MainFragmentRowsAdapterProvider,
        BrowseSupportFragment.MainFragmentAdapterProvider { public RowPresenter.ViewHolder getRowViewHolder(int position) { VerticalGridView verticalView = getVerticalGridView(); if (verticalView == null) { return null; } return getRowViewHolder((ItemBridgeAdapter.ViewHolder) verticalView.findViewHolderForAdapterPosition(position)); }  @Override BrowseSupportFragment.MainFragmentAdapter getMainFragmentAdapter(); @Override BrowseSupportFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter(); void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener); BaseOnItemViewClickedListener getOnItemViewClickedListener(); @Deprecated void enableRowScaling(boolean enable); void setExpand(boolean expand); void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener); BaseOnItemViewSelectedListener getOnItemViewSelectedListener(); RowPresenter.ViewHolder getRowViewHolder(int position); @Override void onCreate(Bundle savedInstanceState); @Override void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState); @Override void onDestroyView(); @Override boolean onTransitionPrepare(); @Override void onTransitionEnd(); void setEntranceTransitionState(boolean afterTransition); void setSelectedPosition(int rowPosition, boolean smooth,
            final Presenter.ViewHolderTask rowHolderTask); boolean isScrolling(); @Override void setAlignment(int windowAlignOffsetFromTop); RowPresenter.ViewHolder findRowViewHolderByPosition(int position); }
RowsSupportFragment extends BaseRowSupportFragment implements
        BrowseSupportFragment.MainFragmentRowsAdapterProvider,
        BrowseSupportFragment.MainFragmentAdapterProvider { public RowPresenter.ViewHolder getRowViewHolder(int position) { VerticalGridView verticalView = getVerticalGridView(); if (verticalView == null) { return null; } return getRowViewHolder((ItemBridgeAdapter.ViewHolder) verticalView.findViewHolderForAdapterPosition(position)); }  @Override BrowseSupportFragment.MainFragmentAdapter getMainFragmentAdapter(); @Override BrowseSupportFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter(); void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener); BaseOnItemViewClickedListener getOnItemViewClickedListener(); @Deprecated void enableRowScaling(boolean enable); void setExpand(boolean expand); void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener); BaseOnItemViewSelectedListener getOnItemViewSelectedListener(); RowPresenter.ViewHolder getRowViewHolder(int position); @Override void onCreate(Bundle savedInstanceState); @Override void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState); @Override void onDestroyView(); @Override boolean onTransitionPrepare(); @Override void onTransitionEnd(); void setEntranceTransitionState(boolean afterTransition); void setSelectedPosition(int rowPosition, boolean smooth,
            final Presenter.ViewHolderTask rowHolderTask); boolean isScrolling(); @Override void setAlignment(int windowAlignOffsetFromTop); RowPresenter.ViewHolder findRowViewHolderByPosition(int position);  }