mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
BookCollection.build()
This commit is contained in:
parent
cc335e3850
commit
2622d74733
3 changed files with 318 additions and 8 deletions
|
@ -34,10 +34,24 @@ public class LibraryService extends Service {
|
|||
if (database == null) {
|
||||
database = new SQLiteBooksDatabase(LibraryService.this, "LIBRARY SERVICE");
|
||||
}
|
||||
final Library collection = Library.Instance();
|
||||
collection.addChangeListener(new Library.ChangeListener() {
|
||||
public void onLibraryChanged(final Code code) {
|
||||
System.err.println("LibraryService.onLibraryChanged(" + code + ")");
|
||||
final BookCollection collection = new BookCollection(database);
|
||||
final long start = System.currentTimeMillis();
|
||||
collection.addChangeListener(new BookCollection.ChangeListener() {
|
||||
public void onCollectionChanged(Code code, Book book) {
|
||||
switch (code) {
|
||||
case BookAdded:
|
||||
System.err.println("Added " + book.getTitle());
|
||||
break;
|
||||
case BuildStarted:
|
||||
System.err.println("Build started");
|
||||
break;
|
||||
case BuildSucceeded:
|
||||
System.err.println("Build succeeded");
|
||||
break;
|
||||
case BuildCompleted:
|
||||
System.err.println("Build completed with " + collection.size() + " books in " + (System.currentTimeMillis() - start) + " milliseconds");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
collection.startBuild();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue