@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // If the drawer is open, show the global app actions in the action bar. See also // showGlobalContextActionBar, which controls the top-left area of the action bar. if (drawerLayout != null && isDrawerOpen()) { inflater.inflate(R.menu.global, menu); presenter.showActionBar(); } super.onCreateOptionsMenu(menu, inflater); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { currentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); fromSavedInstanceState = true; } // Select either the default item (0) or the last selected item. presenter.select(currentSelectedPosition); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Indicate that this fragment would like to influence the set of actions in the action bar. setHasOptionsMenu(true); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Forward the new configuration the drawer toggle component. drawerToggle.onConfigurationChanged(newConfig); }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(STATE_SELECTED_POSITION, currentSelectedPosition); }