@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (getActivity() instanceof MainActivity) { MainActivity mainActivity = (MainActivity) getActivity(); menu.findItem(R.id.refresh).setVisible(!mainActivity.isDrawerOpened()); } }
@Override protected void layoutInit(LayoutInflater inflater, Bundle savedInstanceSate) { super.layoutInit(inflater, savedInstanceSate); loggedIn = AppContext.getUser(); mGroupBean = savedInstanceSate == null ? (TimelineGroupBean) getArguments().getSerializable("bean") : (TimelineGroupBean) savedInstanceSate.getSerializable("bean"); getRefreshView().setOnItemClickListener(this); getRefreshView().setOnItemLongClickListener(this); setHasOptionsMenu(true); ((TextView) findViewById(R.id.layoutEmpty).findViewById(R.id.txtLoadFailed)) .setText(R.string.empty_cmts); }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable("bean", mGroupBean); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.removeGroup(R.id.timeline); if (getActivity() instanceof MainActivity) inflater.inflate(R.menu.refresh_comments, menu); }