@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); view.setClickable(true); Bundle bundle = getArguments(); if (bundle == null) { return; } mEvent = (Event) bundle.getSerializable(ARG_EVENT); mListView = (ListView) view.findViewById(R.id.listView); mListView.setOnScrollListener(new ScrollListener()); mAdapter = new EventNewsAdapter(); mListView.setAdapter(mAdapter); mLoaderCallback = new EventNewsLoaderCallback(); mRestService = HttpHelper.getRestAdapter().create(RestHelper.class); Profile profile = User.currentUser().getProfile(); if (profile != null && profile.getIsAdmin() == 1) { setHasOptionsMenu(true); registerForContextMenu(mListView); } onLoadBegins(); loadEventNews(0); }
@Override public void onDestroyView() { super.onDestroyView(); setHasOptionsMenu(false); getActivity().invalidateOptionsMenu(); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.news, menu); }