@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { mNavigationAdapter.swapCursor(data); mPagerAdapter.swapCursor(data); selectTraining(mPosition); }
/** * 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); }
@Override public void onLoaderReset(Loader<Cursor> loader) { mNavigationAdapter.swapCursor(null); mPagerAdapter.swapCursor(null); }