1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 03:50:19 +02:00

actions constants in LibraryServiceActions interface

This commit is contained in:
Nikolay Pultsin 2015-05-24 12:11:37 +01:00
parent 8047f88a38
commit 63788c87d7
3 changed files with 32 additions and 9 deletions

View file

@ -21,6 +21,7 @@ package org.geometerplus.android.fbreader.libraryService;
import java.util.*;
import android.app.Service;
import android.content.*;
import android.os.IBinder;
import android.os.RemoteException;
@ -47,7 +48,7 @@ public class BookCollectionShadow extends AbstractBookCollection<Book> implement
try {
final String type = intent.getStringExtra("type");
if (LibraryService.BOOK_EVENT_ACTION.equals(intent.getAction())) {
if (LibraryServiceActions.BOOK_EVENT_ACTION.equals(intent.getAction())) {
final Book book = SerializerUtil.deserializeBook(intent.getStringExtra("book"), BookCollectionShadow.this);
fireBookEvent(BookEvent.valueOf(type), book);
} else {
@ -72,7 +73,7 @@ public class BookCollectionShadow extends AbstractBookCollection<Book> implement
final boolean result = context.bindService(
FBReaderIntents.internalIntent(FBReaderIntents.Action.LIBRARY_SERVICE),
this,
LibraryService.BIND_AUTO_CREATE
Service.BIND_AUTO_CREATE
);
if (result) {
myContext = context;
@ -596,8 +597,8 @@ public class BookCollectionShadow extends AbstractBookCollection<Book> implement
Config.Instance().runOnConnect(myOnBindActions.remove(0));
}
if (myContext != null) {
myContext.registerReceiver(myReceiver, new IntentFilter(LibraryService.BOOK_EVENT_ACTION));
myContext.registerReceiver(myReceiver, new IntentFilter(LibraryService.BUILD_EVENT_ACTION));
myContext.registerReceiver(myReceiver, new IntentFilter(LibraryServiceActions.BOOK_EVENT_ACTION));
myContext.registerReceiver(myReceiver, new IntentFilter(LibraryServiceActions.BUILD_EVENT_ACTION));
}
}

View file

@ -42,16 +42,12 @@ import org.geometerplus.android.fbreader.httpd.DataService;
import org.geometerplus.android.fbreader.httpd.DataUtil;
import org.geometerplus.android.fbreader.util.AndroidImageSynchronizer;
public class LibraryService extends Service {
public class LibraryService extends Service implements LibraryServiceActions {
private static SQLiteBooksDatabase ourDatabase;
private static final Object ourDatabaseLock = new Object();
final DataService.Connection DataConnection = new DataService.Connection();
static final String BOOK_EVENT_ACTION = "fbreader.library_service.book_event";
static final String BUILD_EVENT_ACTION = "fbreader.library_service.build_event";
static final String COVER_READY_ACTION = "fbreader.library_service.cover_ready";
private final AndroidImageSynchronizer myImageSynchronizer = new AndroidImageSynchronizer(this);
private static final class Observer extends FileObserver {

View file

@ -0,0 +1,26 @@
/*
* Copyright (C) 2010-2015 FBReader.ORG Limited <contact@fbreader.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
package org.geometerplus.android.fbreader.libraryService;
interface LibraryServiceActions {
String BOOK_EVENT_ACTION = "fbreader.library_service.book_event";
String BUILD_EVENT_ACTION = "fbreader.library_service.build_event";
String COVER_READY_ACTION = "fbreader.library_service.cover_ready";
}