1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 18:29:23 +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

@ -46,7 +46,7 @@ public class AuthorTree extends LibraryTree {
@Override @Override
protected String getSortKey() { protected String getSortKey() {
return Author != null ? Author.SortKey + ":" + Author.DisplayName : null; return Author != null ? "ASK:" + Author.SortKey + ":" + Author.DisplayName : null;
} }
@Override @Override

View file

@ -21,6 +21,8 @@ package org.geometerplus.fbreader.library;
import org.geometerplus.zlibrary.core.image.ZLImage; import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.tree.FBTree;
public class BookTree extends LibraryTree { public class BookTree extends LibraryTree {
public final Book Book; public final Book Book;
private final boolean myShowAuthors; private final boolean myShowAuthors;
@ -86,6 +88,23 @@ public class BookTree extends LibraryTree {
return book != null && book.equals(Book); 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 @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (object == this) { if (object == this) {

View file

@ -61,4 +61,9 @@ public final class SeriesTree extends LibraryTree {
final SeriesInfo info = book.getSeriesInfo(); final SeriesInfo info = book.getSeriesInfo();
return info != null && Series.equals(info.Name); return info != null && Series.equals(info.Name);
} }
@Override
protected String getSortKey() {
return "SSK:" + super.getSortKey();
}
} }