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

fixed library tree comparison

This commit is contained in:
Nikolay Pultsin 2012-04-15 18:59:59 +01:00
parent 803126b649
commit aa4791db4f
3 changed files with 25 additions and 1 deletions

View file

@ -21,6 +21,8 @@ package org.geometerplus.fbreader.library;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.tree.FBTree;
public class BookTree extends LibraryTree {
public final Book Book;
private final boolean myShowAuthors;
@ -86,6 +88,23 @@ public class BookTree extends LibraryTree {
return book != null && book.equals(Book);
}
@Override
protected String getSortKey() {
return "BSK:" + super.getSortKey();
}
@Override
public int compareTo(FBTree tree) {
final int cmp = super.compareTo(tree);
if (cmp == 0 && tree instanceof BookTree) {
final Book b = ((BookTree)tree).Book;
if (Book != null && b != null) {
return Book.File.getPath().compareTo(b.File.getPath());
}
}
return cmp;
}
@Override
public boolean equals(Object object) {
if (object == this) {