@Test public void entranceTransitionBlocksSwitchToVideo() { SingleFragmentTestActivity activity = launchAndWaitActivity(DetailsFragmentEntranceTransition.class, new Options().uiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN), 0); final DetailsFragmentEntranceTransition detailsFragment = (DetailsFragmentEntranceTransition) activity.getTestFragment(); if (Build.VERSION.SDK_INT < 21) { assertTrue(detailsFragment.mDetailsBackgroundController.mCanUseHost); } else { InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { detailsFragment.mDetailsBackgroundController.switchToVideo(); } }); assertFalse(detailsFragment.mDetailsBackgroundController.mCanUseHost); } assertEquals(255, getCoverDrawableAlpha(detailsFragment.mDetailsBackgroundController)); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { detailsFragment.setItem(new PhotoItem("Hello world", "Fake content goes here", androidx.leanback.test.R.drawable.spiderman)); detailsFragment.startEntranceTransition(); } }); PollingCheck.waitFor(4000, new PollingCheck.PollingCheckCondition() { @Override public boolean canProceed() { return detailsFragment.mDetailsBackgroundController.mCanUseHost; } }); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { detailsFragment.mDetailsBackgroundController.switchToVideo(); } }); PollingCheck.waitFor(4000, new PollingCheck.PollingCheckCondition() { @Override public boolean canProceed() { return 0 == getCoverDrawableAlpha(detailsFragment.mDetailsBackgroundController); } }); }
void switchToVideo() { if (mVideoFragment != null && mVideoFragment.getView() != null) { mVideoFragment.getView().requestFocus(); } else { mStateMachine.fireEvent(EVT_SWITCH_TO_VIDEO); } }
DetailsFragment extends BaseFragment { void switchToVideo() { if (mVideoFragment != null && mVideoFragment.getView() != null) { mVideoFragment.getView().requestFocus(); } else { mStateMachine.fireEvent(EVT_SWITCH_TO_VIDEO); } } }
DetailsFragment extends BaseFragment { void switchToVideo() { if (mVideoFragment != null && mVideoFragment.getView() != null) { mVideoFragment.getView().requestFocus(); } else { mStateMachine.fireEvent(EVT_SWITCH_TO_VIDEO); } }  }
DetailsFragment extends BaseFragment { void switchToVideo() { if (mVideoFragment != null && mVideoFragment.getView() != null) { mVideoFragment.getView().requestFocus(); } else { mStateMachine.fireEvent(EVT_SWITCH_TO_VIDEO); } }  void setAdapter(ObjectAdapter adapter); ObjectAdapter getAdapter(); void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener); void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener); BaseOnItemViewClickedListener getOnItemViewClickedListener(); @Override void onCreate(Bundle savedInstanceState); @Override View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState); @Override View onInflateTitleView(LayoutInflater inflater, ViewGroup parent,
                                   Bundle savedInstanceState); RowsFragment getRowsFragment(); void setSelectedPosition(int position); void setSelectedPosition(int position, boolean smooth); @Override void onStop(); @Override void onStart(); DetailsParallax getParallax(); }
DetailsFragment extends BaseFragment { void switchToVideo() { if (mVideoFragment != null && mVideoFragment.getView() != null) { mVideoFragment.getView().requestFocus(); } else { mStateMachine.fireEvent(EVT_SWITCH_TO_VIDEO); } }  void setAdapter(ObjectAdapter adapter); ObjectAdapter getAdapter(); void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener); void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener); BaseOnItemViewClickedListener getOnItemViewClickedListener(); @Override void onCreate(Bundle savedInstanceState); @Override View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState); @Override View onInflateTitleView(LayoutInflater inflater, ViewGroup parent,
                                   Bundle savedInstanceState); RowsFragment getRowsFragment(); void setSelectedPosition(int position); void setSelectedPosition(int position, boolean smooth); @Override void onStop(); @Override void onStart(); DetailsParallax getParallax();  }