// ////////////////////////////////////////////////////////////////////// // LOADERS // ////////////////////////////////////////////////////////////////////// @Override public void onLoadFinished( Loader<LoaderResult<PagingResult<Node>>> loader, LoaderResult<PagingResult<Node>> results) { if (getActivity() instanceof MainActivity && ((MainActivity) getActivity()).getCurrentNode() != null) { selectedItems.clear(); selectedItems.add(((MainActivity) getActivity()).getCurrentNode()); } if (loader instanceof NodeChildrenLoader) { parentFolder = ((NodeChildrenLoader) loader).getParentFolder(); importFolder = parentFolder; } if (mode == MODE_PICK && adapter == null) { selectedMapItems = fragmentPick.retrieveDocumentSelection(); adapter = new ProgressNodeAdapter( getActivity(), BaseCursorGridAdapterHelper.getDisplayItemLayout(getActivity(), gv, displayMode), parentFolder, new ArrayList<Node>(0), selectedMapItems); } else if (adapter == null) { adapter = new ProgressNodeAdapter( getActivity(), BaseCursorGridAdapterHelper.getDisplayItemLayout(getActivity(), gv, displayMode), parentFolder, new ArrayList<Node>(0), selectedItems, mode); } if (results.hasException()) { if (adapter.getCount() == 0) { ev.setVisibility(View.VISIBLE); } onLoaderException(results.getException()); } else { displayPagingData(results.getData(), loaderId, callback); } ((NodeAdapter) adapter).setActivateThumbnail(hasActivateThumbnail()); getActivity().invalidateOptionsMenu(); displayPathShortcut(); checkValidationButton(); }
// /////////////////////////////////////////////////////////////////////////// // LIFECYCLE // /////////////////////////////////////////////////////////////////////////// @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); acc = SessionUtils.getAccount(getActivity()); int[] layouts = BaseCursorGridAdapterHelper.getGridLayoutId(getActivity(), this); adapter = new FavoriteCursorAdapter(this, null, layouts[0], selectedItems, getMode()); gv.setAdapter(adapter); setListShown(false); getLoaderManager().initLoader(0, null, this); }