/** 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()); }
/** * Show selected training and set its behavior * * @param position Position of the training */ private void selectTraining(int position) { mPosition = position; if (mNavigationSpinner.getSelectedItemPosition() != position) mNavigationSpinner.setSelection(position); if (mViewPager.getCurrentItem() != position) mViewPager.setCurrentItem(position); TrainingSetsFragment fragment = (TrainingSetsFragment) mPagerAdapter.getItem(position); mBottomMenu.setOnMenuItemClickListener(fragment); }