1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

Merge branch 'multidir' into rusnavu-master

Conflicts:
	src/org/geometerplus/android/fbreader/libraryService/BookCollectionShadow.java
	src/org/geometerplus/android/fbreader/libraryService/LibraryService.java
	src/org/geometerplus/fbreader/Paths.java
	src/org/geometerplus/fbreader/library/FileFirstLevelTree.java
This commit is contained in:
Nikolay Pultsin 2013-10-12 12:28:10 +01:00
commit faa64fe9a1
7 changed files with 81 additions and 29 deletions

View file

@ -30,27 +30,14 @@ import org.geometerplus.android.fbreader.libraryService.Util;
public class FileFirstLevelTree extends FirstLevelTree {
FileFirstLevelTree(RootTree root) {
super(root, ROOT_FILE_TREE);
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());
}
}
for (String dir : Paths.BookPathOption().getValue()) {
addChild(dir, "fileTreeLibrary", dir);
}
addChild("/", "fileTreeRoot");
addChild(Paths.cardDirectory(), "fileTreeCard");
addChild("/", "fileTreeRoot", null);
addChild(Paths.cardDirectory(), "fileTreeCard", null);
}
private void addChild(String path, String resourceKey) {
private void addChild(String path, String resourceKey, String summary) {
final ZLFile file = ZLFile.createFileByPath(path);
if (file != null) {
final ZLResource resource = resource().getResource(resourceKey);
@ -58,7 +45,7 @@ public class FileFirstLevelTree extends FirstLevelTree {
this,
file,
resource.getValue(),
resource.getResource("summary").getValue()
summary != null ? summary : resource.getResource("summary").getValue()
);
}
}