public void initRoots(Map<String, String> fsRoots) { Log.d("cr3", "Scanner.initRoots(" + fsRoots + ")"); mRoot.clear(); // create recent books dir addRoot(FileInfo.RECENT_DIR_TAG, R.string.dir_recent_books, false); // create system dirs for (Map.Entry<String, String> entry : fsRoots.entrySet()) addRoot(entry.getKey(), entry.getValue(), true); // create OPDS dir addOPDSRoot(); // create search dir addSearchRoot(); // create books by author root addAuthorsRoot(); // create books by series root addSeriesRoot(); // create books by title root addTitleRoot(); }
public FileInfo setSearchResults(FileInfo[] results) { FileInfo existingResults = null; for (int i = 0; i < mRoot.dirCount(); i++) { FileInfo dir = mRoot.getDir(i); if (dir.isSearchDir()) { existingResults = dir; dir.clear(); break; } } if (existingResults == null) { FileInfo dir = new FileInfo(); dir.isDirectory = true; dir.pathname = FileInfo.SEARCH_RESULT_DIR_TAG; dir.filename = mActivity.getResources().getString(R.string.dir_search_results); dir.parent = mRoot; dir.isListed = true; dir.isScanned = true; mRoot.addDir(dir); existingResults = dir; } for (FileInfo item : results) existingResults.addFile(item); return existingResults; }