/**
   * Check to see if item from menu was selected then proceeds properly depending on item selected.
   *
   * @param item item from the menu options
   * @return if the actions were performed properly
   */
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        // to add a new crime
      case R.id.fragment_crime_list_menu_item_new_crime:
        // Create and add new crime
        Crime crime = new Crime();
        CrimeLab.get(getActivity()).addCrime(crime);
        // Create intent to start a new instance of CrimePagerActivity
        Intent intent = CrimePagerActivity.newIntent(getActivity(), crime.getId());
        startActivity(intent);
        return true;

        // to show subtitles and hide "Show Subtitle" option
      case R.id.fragment_crime_list_menu_item_show_subtitle:
        mSubtitleVisible = !mSubtitleVisible;
        // make option invisible/visible
        getActivity().invalidateOptionsMenu();
        updateSubtitle();
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  /** Updates the Interface with all the crimes in recycler views */
  private void updateUI() {
    CrimeLab crimelab = CrimeLab.get(getActivity());
    List<Crime> crimes = crimelab.getCrimes();

    if (mAdapter == null) {
      mAdapter = new CrimeAdapter(crimes);
      mCrimeRecyclerView.setAdapter(mAdapter);
    } else {
      mAdapter.setCrimes(crimes);
      if (mPreviousAdapterSelected < 0) mAdapter.notifyDataSetChanged();
      else {
        mAdapter.notifyItemChanged(mPreviousAdapterSelected);
        mPreviousAdapterSelected = -1;
      }
    }

    // make sure number of crimes stays up to date
    updateSubtitle();
  }