@Override public void onTreeSelected(RepositoryContents content) { String path = content.getPath(); if (RepositoryContents.TYPE_DIR.equals(content.getType())) { mDirStack.push(path); updateBreadcrumbs(); addFragmentForTopOfStack(); } else if (mGitModuleMap != null && mGitModuleMap.get(path) != null) { String[] userRepo = mGitModuleMap.get(path).split("/"); startActivity( IntentUtils.getRepoActivityIntent(getActivity(), userRepo[0], userRepo[1], null)); } else { startActivity( IntentUtils.getFileViewerActivityIntent( getActivity(), mRepository.getOwner().getLogin(), mRepository.getName(), getCurrentRef(), content.getPath())); } }
@Override public void onContentsLoaded(ContentListFragment fragment, List<RepositoryContents> contents) { if (contents == null) { return; } mContentCache.put(fragment.getPath(), new ArrayList<>(contents)); if (fragment.getPath() == null) { for (RepositoryContents content : contents) { if (RepositoryContents.TYPE_FILE.equals(content.getType())) { if (content.getName().equals(".gitmodules")) { LoaderManager lm = getActivity().getSupportLoaderManager(); lm.restartLoader(LOADER_MODULEMAP, null, mGitModuleCallback); break; } } } } if (mInitialPathToLoad != null && !mInitialPathToLoad.isEmpty()) { String itemToLoad = mInitialPathToLoad.get(0); boolean found = false; for (RepositoryContents content : contents) { if (RepositoryContents.TYPE_DIR.equals(content.getType())) { if (content.getPath().equals(itemToLoad)) { onTreeSelected(content); found = true; break; } } } if (found) { mInitialPathToLoad.remove(0); } else { mInitialPathToLoad = null; } } }