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

do not kill library service too often

This commit is contained in:
Nikolay Pultsin 2013-03-02 14:39:11 +04:00
parent 2d91e8d7b6
commit 32e122113a
2 changed files with 8 additions and 11 deletions

View file

@ -183,6 +183,7 @@ public final class FBReader extends Activity {
if (myFBReaderApp == null) { if (myFBReaderApp == null) {
myFBReaderApp = new FBReaderApp(new BookCollectionShadow()); myFBReaderApp = new FBReaderApp(new BookCollectionShadow());
} }
getCollection().bindToService(this, null);
myBook = null; myBook = null;
final ZLAndroidApplication androidApplication = (ZLAndroidApplication)getApplication(); final ZLAndroidApplication androidApplication = (ZLAndroidApplication)getApplication();
@ -454,10 +455,15 @@ public final class FBReader extends Activity {
protected void onStop() { protected void onStop() {
ApiServerImplementation.sendEvent(this, ApiListener.EVENT_READ_MODE_CLOSED); ApiServerImplementation.sendEvent(this, ApiListener.EVENT_READ_MODE_CLOSED);
PopupPanel.removeAllWindows(myFBReaderApp, this); PopupPanel.removeAllWindows(myFBReaderApp, this);
getCollection().unbind();
super.onStop(); super.onStop();
} }
@Override
protected void onDestroy() {
getCollection().unbind();
super.onDestroy();
}
@Override @Override
public void onLowMemory() { public void onLowMemory() {
myFBReaderApp.onWindowClosing(); myFBReaderApp.onWindowClosing();

View file

@ -68,11 +68,7 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
getListView().setTextFilterEnabled(true); getListView().setTextFilterEnabled(true);
getListView().setOnCreateContextMenuListener(this); getListView().setOnCreateContextMenuListener(this);
}
@Override
protected void onStart() {
super.onStart();
((BookCollectionShadow)myRootTree.Collection).bindToService(this, new Runnable() { ((BookCollectionShadow)myRootTree.Collection).bindToService(this, new Runnable() {
public void run() { public void run() {
setProgressBarIndeterminateVisibility(!myRootTree.Collection.status().IsCompleted); setProgressBarIndeterminateVisibility(!myRootTree.Collection.status().IsCompleted);
@ -102,15 +98,10 @@ public class LibraryActivity extends TreeActivity<LibraryTree> implements MenuIt
return key != null ? myRootTree.getLibraryTree(key) : myRootTree; return key != null ? myRootTree.getLibraryTree(key) : myRootTree;
} }
@Override
protected void onStop() {
((BookCollectionShadow)myRootTree.Collection).unbind();
super.onStop();
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
myRootTree.Collection.removeListener(this); myRootTree.Collection.removeListener(this);
((BookCollectionShadow)myRootTree.Collection).unbind();
super.onDestroy(); super.onDestroy();
} }