Skip to content

Commit

Permalink
more onBookEvent implementations + updated TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
geometer committed Feb 11, 2013
1 parent ee0b65c commit b9fd0cb
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 19 deletions.
6 changes: 2 additions & 4 deletions TODO.libraryService
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ DONE summaries for libraryTrees
DONE progress indicator in library activity
DONE book search
DONE books for series _and_ author
* update book collection on path changing (from options dialog)

new:
* filesystem event listener
* update book collection on path changing (from options dialog)
DONE read book => go to library => go to book info => update book info => return to reading mode: book info is not updated
* text search => found multiple occurencies => turn page right => right button is disabled
* authors/books by author request
* tags/books by tag request
* series/books by series request
* 'rescan' button in library menu
* getHelpFile => getHelpBook
* move BookCollection to libraryService package; change access rights to package local
Expand All @@ -27,6 +24,7 @@ small features:
large features:
* two page view
* bookmarks highlighting
* https://en.wikipedia.org/wiki/Alphabetical_order

plugin:
* bookmarks import/export
6 changes: 3 additions & 3 deletions src/org/geometerplus/fbreader/library/AuthorListTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public void waitForOpening() {
public boolean onBookEvent(BookEvent event, Book book) {
switch (event) {
case Added:
case Updated:
{
// TODO: remove empty authors tree after update (?)
final List<Author> bookAuthors = book.authors();
boolean changed = false;
if (bookAuthors.isEmpty()) {
Expand All @@ -57,11 +59,9 @@ public boolean onBookEvent(BookEvent event, Book book) {
return changed;
}
case Removed:
// TODO: implement
// TODO: remove empty authors tree (?)
return false;
default:
case Updated:
// TODO: implement
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/org/geometerplus/fbreader/library/SeriesListTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public void waitForOpening() {
public boolean onBookEvent(BookEvent event, Book book) {
switch (event) {
case Added:
case Updated:
{
// TODO: remove empty series tree after update (?)
final SeriesInfo info = book.getSeriesInfo();
return info != null && createSeriesSubTree(info.Title);
}
case Removed:
// TODO: implement
// TODO: remove empty series tree (?)
return false;
default:
case Updated:
// TODO: implement
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/org/geometerplus/fbreader/library/TagListTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public void waitForOpening() {
public boolean onBookEvent(BookEvent event, Book book) {
switch (event) {
case Added:
case Updated:
{
// TODO: remove empty tag trees after update (?)
final List<Tag> bookTags = book.tags();
boolean changed = false;
if (bookTags.isEmpty()) {
Expand All @@ -61,11 +63,9 @@ public boolean onBookEvent(BookEvent event, Book book) {
return changed;
}
case Removed:
// TODO: implement
// TODO: remove empty tag trees (?)
return false;
default:
case Updated:
// TODO: implement
return false;
}
}
Expand Down
21 changes: 19 additions & 2 deletions src/org/geometerplus/fbreader/library/TagTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,26 @@ public boolean onBookEvent(BookEvent event, Book book) {
return changed;
}
case Removed:
// TODO: implement
// TODO: remove empty tag trees (?)
return super.onBookEvent(event, book);
case Updated:
// TODO: implement
{
// TODO: remove empty tag trees (?)
boolean changed = removeBook(book);
final List<Tag> bookTags = book.tags();
if (bookTags.isEmpty()) {
changed &= Tag.NULL.equals(Tag) && createBookWithAuthorsSubTree(book);
} else {
for (Tag t : bookTags) {
if (Tag.equals(t)) {
changed &= createBookWithAuthorsSubTree(book);
} else if (Tag.equals(t.Parent)) {
changed &= createTagSubTree(t);
}
}
}
return changed;
}
default:
return super.onBookEvent(event, book);
}
Expand Down
19 changes: 15 additions & 4 deletions src/org/geometerplus/fbreader/library/TitleListTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,23 @@ public boolean onBookEvent(BookEvent event, Book book) {
return createBookWithAuthorsSubTree(book);
}
case Removed:
// TODO: implement
return false;
if (myDoGroupByFirstLetter) {
// TODO: remove old tree (?)
return false;
} else {
return super.onBookEvent(event, book);
}
default:
case Updated:
// TODO: implement
return false;
if (myDoGroupByFirstLetter) {
// TODO: remove old tree (?)
final String letter = TitleUtil.firstTitleLetter(book);
return letter != null && createTitleSubTree(letter);
} else {
boolean changed = removeBook(book);
changed |= containsBook(book) && createBookWithAuthorsSubTree(book);
return changed;
}
}
}

Expand Down

0 comments on commit b9fd0cb

Please sign in to comment.