@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_controls); initView(); setListener(); }
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { player.setFullscreen(true); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { player.setFullscreen(false); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.youtube_playerview); youtubeVideoID = getIntent().getStringExtra(YOUTUBE_VIDEO_ID); viewContainer = (ActionBarPaddedFrameLayout) findViewById(R.id.view_container); playerFragment = (YouTubePlayerFragment) getFragmentManager().findFragmentById(R.id.player_fragment); playerFragment.initialize(Constants.YOUTUBE_DEVELOPER_KEY, this); viewContainer.setActionBar(getActionBar()); // Action bar background is transparent by default. getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.primary))); }
@Override protected void onRestoreInstanceState(Bundle state) { super.onRestoreInstanceState(state); currentlySelectedId = state.getString(KEY_CURRENTLY_SELECTED_ID); }
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putString(KEY_CURRENTLY_SELECTED_ID, currentlySelectedId); }