mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
library service in operation ;)
This commit is contained in:
parent
59a7c6b697
commit
9d9a30a7d1
2 changed files with 9 additions and 9 deletions
|
@ -27,13 +27,20 @@ import org.geometerplus.fbreader.library.*;
|
|||
|
||||
import org.geometerplus.android.fbreader.library.SQLiteBooksDatabase;
|
||||
|
||||
public class LibraryService extends Service implements Library.ChangeListener {
|
||||
public class LibraryService extends Service {
|
||||
public final class LibraryImplementation extends LibraryInterface.Stub {
|
||||
LibraryImplementation() {
|
||||
BooksDatabase database = SQLiteBooksDatabase.Instance();
|
||||
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 + ")");
|
||||
}
|
||||
});
|
||||
collection.startBuild();
|
||||
}
|
||||
|
||||
public boolean isUpToDate() {
|
||||
|
@ -66,19 +73,12 @@ public class LibraryService extends Service implements Library.ChangeListener {
|
|||
System.err.println("LibraryService.onCreate()");
|
||||
super.onCreate();
|
||||
myLibrary = new LibraryImplementation();
|
||||
//myLibrary.myBaseLibrary.addChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
System.err.println("LibraryService.onDestroy()");
|
||||
//myLibrary.myBaseLibrary.removeChangeListener(this);
|
||||
myLibrary = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void onLibraryChanged(final Code code) {
|
||||
// TODO: implement signal sending
|
||||
System.err.println("LibraryService.onLibraryChanged(" + code + "): " + myLibrary.isUpToDate());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue