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

Merge branch 'master' into library-service

Conflicts:
	src/org/geometerplus/fbreader/library/Library.java
This commit is contained in:
Nikolay Pultsin 2013-02-09 15:45:02 +04:00
commit e6598e2da7
11 changed files with 230 additions and 54 deletions

View file

@ -147,7 +147,29 @@ public class BookCollectionShadow extends AbstractBookCollection implements Serv
}
}
public synchronized List<Book> books(String pattern) {
public synchronized List<Book> booksForSeries(String series) {
if (myInterface == null) {
return Collections.emptyList();
}
try {
return SerializerUtil.deserializeBookList(myInterface.booksForSeries(series));
} catch (RemoteException e) {
return Collections.emptyList();
}
}
public synchronized List<Book> booksForTitlePrefix(String prefix) {
if (myInterface == null) {
return Collections.emptyList();
}
try {
return SerializerUtil.deserializeBookList(myInterface.booksForTitlePrefix(prefix));
} catch (RemoteException e) {
return Collections.emptyList();
}
}
public synchronized List<Book> booksForPattern(String pattern) {
if (myInterface == null) {
return Collections.emptyList();
}
@ -245,16 +267,25 @@ public class BookCollectionShadow extends AbstractBookCollection implements Serv
}
}
public synchronized boolean hasSeries() {
if (myInterface != null) {
try {
return myInterface.hasSeries();
} catch (RemoteException e) {
}
}
return false;
}
public synchronized List<String> series() {
if (myInterface == null) {
return Collections.emptyList();
}
//try {
// TODO: implement
try {
return myInterface.series();
} catch (RemoteException e) {
return Collections.emptyList();
//} catch (RemoteException e) {
// return Collections.emptyList();
//}
}
}
public synchronized boolean saveBook(Book book, boolean force) {

View file

@ -12,6 +12,8 @@ interface LibraryInterface {
List<String> books();
List<String> booksForAuthor(in String author);
List<String> booksForTag(in String tag);
List<String> booksForSeries(in String series);
List<String> booksForTitlePrefix(in String prefix);
List<String> booksForPattern(in String pattern);
List<String> recentBooks();
List<String> favorites();
@ -20,6 +22,7 @@ interface LibraryInterface {
String getRecentBook(in int index);
List<String> authors();
boolean hasSeries();
List<String> series();
List<String> tags();

View file

@ -132,8 +132,16 @@ public class LibraryService extends Service {
return SerializerUtil.serializeBookList(myCollection.books(Util.stringToTag(tag)));
}
public List<String> booksForSeries(String series) {
return SerializerUtil.serializeBookList(myCollection.booksForSeries(series));
}
public List<String> booksForTitlePrefix(String prefix) {
return SerializerUtil.serializeBookList(myCollection.booksForTitlePrefix(prefix));
}
public List<String> booksForPattern(String pattern) {
return SerializerUtil.serializeBookList(myCollection.books(pattern));
return SerializerUtil.serializeBookList(myCollection.booksForPattern(pattern));
}
public List<String> recentBooks() {
@ -165,6 +173,10 @@ public class LibraryService extends Service {
return strings;
}
public boolean hasSeries() {
return myCollection.hasSeries();
}
public List<String> series() {
return myCollection.series();
}