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

synchronization with library-service branch

This commit is contained in:
Nikolay Pultsin 2013-01-20 04:54:06 +04:00
parent d0e1411ce5
commit a11a63b3ea
3 changed files with 14 additions and 3 deletions

View file

@ -23,10 +23,14 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.zlibrary.core.filesystem.ZLFile; import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.Paths; import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.book.IBookCollection;
public class FileFirstLevelTree extends FirstLevelTree { public class FileFirstLevelTree extends FirstLevelTree {
FileFirstLevelTree(RootTree root, String id) { private final IBookCollection myCollection;
FileFirstLevelTree(IBookCollection collection, RootTree root, String id) {
super(root, id); super(root, id);
myCollection = collection;
addChild(Paths.BooksDirectoryOption().getValue(), "fileTreeLibrary"); addChild(Paths.BooksDirectoryOption().getValue(), "fileTreeLibrary");
addChild("/", "fileTreeRoot"); addChild("/", "fileTreeRoot");
addChild(Paths.cardDirectory(), "fileTreeCard"); addChild(Paths.cardDirectory(), "fileTreeCard");
@ -38,6 +42,7 @@ public class FileFirstLevelTree extends FirstLevelTree {
final ZLResource resource = Library.resource().getResource(resourceKey); final ZLResource resource = Library.resource().getResource(resourceKey);
new FileTree( new FileTree(
this, this,
myCollection,
file, file,
resource.getValue(), resource.getValue(),
resource.getResource("summary").getValue() resource.getResource("summary").getValue()

View file

@ -24,17 +24,20 @@ import java.util.*;
import org.geometerplus.zlibrary.core.filesystem.ZLFile; import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.image.ZLImage; import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.*;
import org.geometerplus.fbreader.formats.PluginCollection; import org.geometerplus.fbreader.formats.PluginCollection;
import org.geometerplus.fbreader.tree.FBTree; import org.geometerplus.fbreader.tree.FBTree;
public class FileTree extends LibraryTree { public class FileTree extends LibraryTree {
private final IBookCollection myCollection;
private final ZLFile myFile; private final ZLFile myFile;
private final String myName; private final String myName;
private final String mySummary; private final String mySummary;
private final boolean myIsSelectable; private final boolean myIsSelectable;
FileTree(LibraryTree parent, ZLFile file, String name, String summary) { FileTree(LibraryTree parent, IBookCollection collection, ZLFile file, String name, String summary) {
super(parent); super(parent);
myCollection = collection;
myFile = file; myFile = file;
myName = name; myName = name;
mySummary = summary; mySummary = summary;
@ -43,6 +46,7 @@ public class FileTree extends LibraryTree {
public FileTree(FileTree parent, ZLFile file) { public FileTree(FileTree parent, ZLFile file) {
super(parent); super(parent);
myCollection = parent.myCollection;
myFile = file; myFile = file;
myName = null; myName = null;
mySummary = null; mySummary = null;

View file

@ -87,6 +87,7 @@ public final class Library {
} }
} }
public final IBookCollection Collection;
private final BooksDatabase myDatabase; private final BooksDatabase myDatabase;
private final Map<ZLFile,Book> myBooks = private final Map<ZLFile,Book> myBooks =
@ -109,6 +110,7 @@ public final class Library {
} }
public Library(BooksDatabase db) { public Library(BooksDatabase db) {
Collection = null;
myDatabase = db; myDatabase = db;
new FavoritesTree(myRootTree, ROOT_FAVORITES); new FavoritesTree(myRootTree, ROOT_FAVORITES);
@ -116,7 +118,7 @@ public final class Library {
new FirstLevelTree(myRootTree, ROOT_BY_AUTHOR); new FirstLevelTree(myRootTree, ROOT_BY_AUTHOR);
new FirstLevelTree(myRootTree, ROOT_BY_TITLE); new FirstLevelTree(myRootTree, ROOT_BY_TITLE);
new FirstLevelTree(myRootTree, ROOT_BY_TAG); new FirstLevelTree(myRootTree, ROOT_BY_TAG);
new FileFirstLevelTree(myRootTree, ROOT_FILE_TREE); new FileFirstLevelTree(Collection, myRootTree, ROOT_FILE_TREE);
} }
public LibraryTree getRootTree() { public LibraryTree getRootTree() {