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

introduced BookWithAuthorsTree class

This commit is contained in:
Nikolay Pultsin 2013-02-08 08:27:46 +00:00
parent a46e23e78e
commit dfd771c346
6 changed files with 81 additions and 42 deletions

View file

@ -26,24 +26,20 @@ import org.geometerplus.fbreader.tree.FBTree;
public class BookTree extends LibraryTree {
public final Book Book;
private final boolean myShowAuthors;
BookTree(IBookCollection collection, Book book, boolean showAuthors) {
BookTree(IBookCollection collection, Book book) {
super(collection);
Book = book;
myShowAuthors = showAuthors;
}
BookTree(LibraryTree parent, Book book, boolean showAuthors) {
BookTree(LibraryTree parent, Book book) {
super(parent);
Book = book;
myShowAuthors = showAuthors;
}
BookTree(LibraryTree parent, Book book, boolean showAuthors, int position) {
BookTree(LibraryTree parent, Book book, int position) {
super(parent, position);
Book = book;
myShowAuthors = showAuthors;
}
@Override
@ -61,25 +57,6 @@ public class BookTree extends LibraryTree {
return "@BookTree " + getName();
}
@Override
public String getSummary() {
if (!myShowAuthors) {
return super.getSummary();
}
StringBuilder builder = new StringBuilder();
int count = 0;
for (Author author : Book.authors()) {
if (count++ > 0) {
builder.append(", ");
}
builder.append(author.DisplayName);
if (count == 5) {
break;
}
}
return builder.toString();
}
@Override
protected ZLImage createCover() {
return BookUtil.getCover(Book);