mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
Notifications changes
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1329 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
884abfd97c
commit
fb98c93315
11 changed files with 144 additions and 22 deletions
|
@ -27,26 +27,35 @@ import org.geometerplus.fbreader.network.NetworkLibraryItem;
|
|||
|
||||
abstract class ItemsLoadingRunnable implements Runnable {
|
||||
|
||||
public static final int CATALOG_LOADING = 0;
|
||||
public static final int NETWORK_SEARCH = 1;
|
||||
|
||||
public final AtomicBoolean InterruptFlag = new AtomicBoolean();
|
||||
public final int Type;
|
||||
|
||||
private final ItemsLoadingHandler myHandler;
|
||||
|
||||
private final long myUpdateInterval; // in milliseconds
|
||||
private final int myItemsLimit;
|
||||
|
||||
public ItemsLoadingRunnable(ItemsLoadingHandler handler) {
|
||||
this(handler, 1000, 250);
|
||||
public ItemsLoadingRunnable(ItemsLoadingHandler handler, int type) {
|
||||
this(handler, type, 1000, 250);
|
||||
}
|
||||
|
||||
public ItemsLoadingRunnable(ItemsLoadingHandler handler, long updateIntervalMillis, int itemsLimit) {
|
||||
public ItemsLoadingRunnable(ItemsLoadingHandler handler, int type, long updateIntervalMillis, int itemsLimit) {
|
||||
myHandler = handler;
|
||||
myUpdateInterval = updateIntervalMillis;
|
||||
myItemsLimit = itemsLimit;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public abstract String doBefore();
|
||||
public abstract String doLoading(NetworkOperationData.OnNewItemListener doWithListener);
|
||||
|
||||
public abstract int getNotificationId();
|
||||
public abstract String getResourceKey();
|
||||
|
||||
|
||||
public final void run() {
|
||||
String err = doBefore();
|
||||
if (err != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue