@Override public void onAttach(Activity activity) { super.onAttach(activity); if (!(getActivity() instanceof MainActivity)) { throw new ClassCastException("MainNavFragment should be attached to MainActivity"); } }
@Override public void setUp(int fragmentId, DrawerLayout drawerLayout) { super.setUp(fragmentId, drawerLayout); if (isOpen()) { getMainActivity().showAddRemoteButton(); } mDrawerLayout.setDrawerListener( new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { getMainActivity().getAddRemoteButton().setOffset(slideOffset); } }); update(); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); }