mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
Multicatalog library
This commit is contained in:
parent
b98e903f87
commit
0382c50103
8 changed files with 38 additions and 15 deletions
|
@ -19,15 +19,33 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||
|
||||
import org.geometerplus.fbreader.Paths;
|
||||
import org.geometerplus.android.fbreader.libraryService.Util;
|
||||
|
||||
public class FileFirstLevelTree extends FirstLevelTree {
|
||||
FileFirstLevelTree(RootTree root) {
|
||||
super(root, ROOT_FILE_TREE);
|
||||
addChild(Paths.BooksDirectoryOption().getValue(), "fileTreeLibrary");
|
||||
List<String> directories = Util.splitDirectories(Paths.BooksDirectoryOption().getValue());
|
||||
if (directories.size() == 1)
|
||||
addChild(directories.get(0), NODE_LIBRARY_DIRECTORY);
|
||||
else {
|
||||
FirstLevelTree libraryGroup = new FirstLevelTree(this, NODE_LIBRARY_DIRECTORY);
|
||||
for (String d : directories) {
|
||||
final ZLFile file = ZLFile.createFileByPath(d);
|
||||
if (file != null) {
|
||||
new FileTree(
|
||||
libraryGroup,
|
||||
file,
|
||||
file.getShortName(),
|
||||
file.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
addChild("/", "fileTreeRoot");
|
||||
addChild(Paths.cardDirectory(), "fileTreeCard");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue