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:
parent
a46e23e78e
commit
dfd771c346
6 changed files with 81 additions and 42 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue