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

KillerCallback instead of KillerService

This commit is contained in:
Nikolay Pultsin 2010-12-29 20:46:32 +00:00
parent d7e937f8b1
commit ad9da69389
3 changed files with 7 additions and 24 deletions

View file

@ -66,7 +66,7 @@
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
</activity>
<service android:name="org.geometerplus.android.fbreader.library.InitializationService" android:process=":library" />
<service android:name="org.geometerplus.android.fbreader.library.KillerService" android:process=":library" />
<receiver android:name="org.geometerplus.android.fbreader.library.KillerCallback" android:process=":library" />
<activity android:name="org.geometerplus.android.fbreader.library.LibraryTopLevelActivity" android:launchMode="singleTask" android:process=":library" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />

View file

@ -44,7 +44,7 @@ import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
import org.geometerplus.fbreader.fbreader.ActionCode;
import org.geometerplus.fbreader.fbreader.FBReaderApp;
import org.geometerplus.android.fbreader.library.KillerService;
import org.geometerplus.android.fbreader.library.KillerCallback;
public final class FBReader extends ZLAndroidActivity {
public static final String BOOK_PATH_KEY = "BookPath";
@ -185,7 +185,7 @@ public final class FBReader extends ZLAndroidActivity {
@Override
public void onResume() {
super.onResume();
startService(new Intent(getApplicationContext(), KillerService.class));
sendBroadcast(new Intent(getApplicationContext(), KillerCallback.class));
ControlButtonPanel.restoreVisibilities();
}

View file

@ -19,31 +19,14 @@
package org.geometerplus.android.fbreader.library;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.os.Process;
public class KillerService extends Service {
public class KillerCallback extends BroadcastReceiver {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onStart(Intent intent, int startId) {
stopSelf();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
onStart(intent, startId);
return 0;
}
@Override
public void onDestroy() {
super.onDestroy();
public void onReceive(Context context, Intent intent) {
Process.killProcess(Process.myPid());
}
}