/** Create ActionMenuView on the bottom of the Activity */
  private void createBottomMenu(View view) {
    ViewGroup bottomMenuStub = (ViewGroup) view.findViewById(R.id.bottom_menu_stub);
    LayoutInflater.from(mToolbar.getContext())
        .inflate(R.layout.training_process_bottom_menu, bottomMenuStub, true);
    mBottomMenu = (ActionMenuView) bottomMenuStub.findViewById(R.id.bottom_menu);

    getActivity().getMenuInflater().inflate(R.menu.training_process, mBottomMenu.getMenu());

    mTimerMenuItem =
        new TimerMenuItem(getActivity(), mBottomMenu.getMenu().findItem(R.id.action_timer));
    mTimerMenuItem.configure(mPreferences.getTimerValue(), mPreferences.isVibrateTimer());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    setHasOptionsMenu(true);

    mPreferences = new Preferences(getActivity());
    mPreferences.registerOnSharedPreferenceChangeListener(this);

    if (savedInstanceState != null) {
      // Restore data from saved instant state
      retrieveData(savedInstanceState);
    } else {
      // Retrieve data from intent
      retrieveData(getArguments());
    }
  }
 @Override
 public void onDestroy() {
   mPreferences.unregisterOnSharedPreferenceChangeListener(this);
   super.onDestroy();
 }
 @Override
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   mTimerMenuItem.configure(mPreferences.getTimerValue(), mPreferences.isVibrateTimer());
 }