Exemplo n.º 1
0
  @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);
  }
Exemplo n.º 2
0
 @Override
 public void onDestroyView() {
   super.onDestroyView();
   setHasOptionsMenu(false);
   getActivity().invalidateOptionsMenu();
 }
Exemplo n.º 3
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    inflater.inflate(R.menu.news, menu);
  }