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

more "architecture" around book serialization

This commit is contained in:
Nikolay Pultsin 2013-01-10 05:54:40 +04:00
parent ea45b239a1
commit 4d4a495b7c
8 changed files with 134 additions and 19 deletions

View file

@ -19,6 +19,9 @@
package org.geometerplus.android.fbreader.libraryService;
import java.util.Collections;
import java.util.List;
import android.content.*;
import android.os.IBinder;
import android.os.RemoteException;
@ -46,12 +49,23 @@ public class BookCollectionShadow implements IBookCollection, ServiceConnection
return null;
}
try {
return BookSerializerUtil.deserialize(myInterface.bookById(id));
return SerializerUtil.deserializeBook(myInterface.bookById(id));
} catch (RemoteException e) {
return null;
}
}
public synchronized List<Bookmark> allBookmarks() {
if (myInterface == null) {
return Collections.emptyList();
}
try {
return SerializerUtil.deserializeBookmarkList(myInterface.allBookmarks());
} catch (RemoteException e) {
return Collections.emptyList();
}
}
// method from ServiceConnection interface
public synchronized void onServiceConnected(ComponentName name, IBinder service) {
myInterface = LibraryInterface.Stub.asInterface(service);