1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

Library stores IBookCollection reference, not BookCollection one

This commit is contained in:
Nikolay Pultsin 2013-01-12 22:40:28 +04:00
parent e6f437e790
commit 2bced4b331
4 changed files with 31 additions and 20 deletions

View file

@ -56,6 +56,14 @@ public class BookCollectionShadow implements IBookCollection, ServiceConnection
}
}
public void addListener(Listener listener) {
// TODO: implement
}
public void removeListener(Listener listener) {
// TODO: implement
}
public synchronized int size() {
if (myInterface == null) {
return 0;

View file

@ -31,25 +31,6 @@ import org.geometerplus.fbreader.bookmodel.BookReadingException;
public class BookCollection implements IBookCollection {
private final List<Listener> myListeners = Collections.synchronizedList(new LinkedList<Listener>());
public interface Listener {
public enum BookEvent {
Added,
Updated,
Removed
}
public enum BuildEvent {
Started,
NotStarted,
Succeeded,
Failed,
Completed
}
void onBookEvent(BookEvent event, Book book);
void onBuildEvent(BuildEvent event);
}
public void addListener(Listener listener) {
myListeners.add(listener);
}

View file

@ -22,6 +22,28 @@ package org.geometerplus.fbreader.library;
import java.util.List;
public interface IBookCollection {
public interface Listener {
public enum BookEvent {
Added,
Updated,
Removed
}
public enum BuildEvent {
Started,
NotStarted,
Succeeded,
Failed,
Completed
}
void onBookEvent(BookEvent event, Book book);
void onBuildEvent(BuildEvent event);
}
public void addListener(Listener listener);
public void removeListener(Listener listener);
int size();
List<Book> books(String pattern);
List<Book> recentBooks();

View file

@ -70,7 +70,7 @@ public final class Library {
public static final int REMOVE_FROM_DISK = 0x02;
public static final int REMOVE_FROM_LIBRARY_AND_DISK = REMOVE_FROM_LIBRARY | REMOVE_FROM_DISK;
private final BookCollection myCollection;
private final IBookCollection myCollection;
private final RootTree myRootTree = new RootTree();
private boolean myDoGroupTitlesByFirstLetter;