mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
KillerCallback instead of KillerService
This commit is contained in:
parent
d7e937f8b1
commit
ad9da69389
3 changed files with 7 additions and 24 deletions
|
@ -66,7 +66,7 @@
|
||||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
||||||
</activity>
|
</activity>
|
||||||
<service android:name="org.geometerplus.android.fbreader.library.InitializationService" android:process=":library" />
|
<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">
|
<activity android:name="org.geometerplus.android.fbreader.library.LibraryTopLevelActivity" android:launchMode="singleTask" android:process=":library" android:configChanges="orientation|keyboardHidden">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
||||||
import org.geometerplus.fbreader.fbreader.ActionCode;
|
import org.geometerplus.fbreader.fbreader.ActionCode;
|
||||||
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
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 final class FBReader extends ZLAndroidActivity {
|
||||||
public static final String BOOK_PATH_KEY = "BookPath";
|
public static final String BOOK_PATH_KEY = "BookPath";
|
||||||
|
@ -185,7 +185,7 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
startService(new Intent(getApplicationContext(), KillerService.class));
|
sendBroadcast(new Intent(getApplicationContext(), KillerCallback.class));
|
||||||
ControlButtonPanel.restoreVisibilities();
|
ControlButtonPanel.restoreVisibilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,31 +19,14 @@
|
||||||
|
|
||||||
package org.geometerplus.android.fbreader.library;
|
package org.geometerplus.android.fbreader.library;
|
||||||
|
|
||||||
import android.app.Service;
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
|
||||||
public class KillerService extends Service {
|
public class KillerCallback extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent) {
|
public void onReceive(Context context, 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();
|
|
||||||
Process.killProcess(Process.myPid());
|
Process.killProcess(Process.myPid());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue