@Override public void onActivityCreated(final Bundle savedInstanceState) { if (savedInstanceState != null) { mPage = savedInstanceState.getInt(EXTRA_PAGE, 1); } super.onActivityCreated(savedInstanceState); }
@Override public void onLoadFinished( final Loader<List<ParcelableUser>> loader, final List<ParcelableUser> data) { super.onLoadFinished(loader, data); if (loader instanceof UserSearchLoader) { mPage = ((UserSearchLoader) loader).getPage(); } }
@Override public void onLoadMoreContents(@IndicatorPosition int position) { // Only supports load from end, skip START flag if ((position & IndicatorPosition.START) != 0) return; super.onLoadMoreContents(position); if (position == 0) return; final Bundle loaderArgs = new Bundle(getArguments()); loaderArgs.putBoolean(EXTRA_FROM_USER, true); loaderArgs.putInt(EXTRA_PAGE, mPage + 1); getLoaderManager().restartLoader(0, loaderArgs, this); }
@Override public void onDestroyView() { mPage = 1; super.onDestroyView(); }
@Override public void onSaveInstanceState(final Bundle outState) { outState.putInt(EXTRA_PAGE, mPage); super.onSaveInstanceState(outState); }