Source:
<code>public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { messageContainer.setVisibility(View.GONE); if (Build.VERSION.SDK_INT < 16) { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { View decorView = getActivity().getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); } LinearLayout playerContainer = (LinearLayout)getView().findViewById(R.id.player_container); if ( playerContainer != null ) { DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); float screenHeight = displayMetrics.heightPixels; playerContainer.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, (int) screenHeight)); playerContainer.requestLayout(); } } else { messageContainer.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT < 16) { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } else { View decorView = getActivity().getWindow().getDecorView(); decorView.setSystemUiVisibility(View.VISIBLE); } LinearLayout playerContainer = (LinearLayout)getView().findViewById(R.id.player_container); if ( playerContainer != null ) { DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); float screenWidth = displayMetrics.widthPixels; float ideaHeight = screenWidth * 9 / 16; playerContainer.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, (int) ideaHeight)); playerContainer.requestLayout(); } } if (playerFragment != null) { <START> playerFragment.handleOnResume(); <END> } }</code><technical_language>Instead of hacking effect invoking resume callback, implement onConfigurationChanged() callback in PlayerFragment instead, call player.setFullScreen(isScreenLandscape()); directly</technical_language>

Target:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { messageContainer.setVisibility(View.GONE); if (Build.VERSION.SDK_INT < 16) { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { View decorView = getActivity().getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); } LinearLayout playerContainer = (LinearLayout)getView().findViewById(R.id.player_container); if ( playerContainer != null ) { DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); float screenHeight = displayMetrics.heightPixels; playerContainer.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, (int) screenHeight)); playerContainer.requestLayout(); } } else { messageContainer.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT < 16) { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } else { View decorView = getActivity().getWindow().getDecorView(); decorView.setSystemUiVisibility(View.VISIBLE); } LinearLayout playerContainer = (LinearLayout)getView().findViewById(R.id.player_container); if ( playerContainer != null ) { DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); float screenWidth = displayMetrics.widthPixels; float ideaHeight = screenWidth * 9 / 16; playerContainer.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, (int) ideaHeight)); playerContainer.requestLayout(); } } }