Do not add neighbors on page success

Might resolve #536 #540
This commit is contained in:
FooIbar authored and tarsin committed 2022-12-18 09:13:38 +08:00
1 parent 7b906f3c3e
commit 34be285510
3 files changed
+6 -8

No files matched your search

@@ -126,7 +126,7 @@ public class EhPageLoader extends PageLoader2 implements SpiderQueen.OnSpiderLis
@Override
protected void onRequest(int index) {
if (mSpiderQueen != null) {
Object object = mSpiderQueen.request(index);
Object object = mSpiderQueen.request(index, true);
if (object instanceof Float) {
notifyPagePercent(index, (Float) object);
} else if (object instanceof String) {
@@ -186,7 +186,9 @@ public class EhPageLoader extends PageLoader2 implements SpiderQueen.OnSpiderLis
@Override
public void onPageSuccess(int index, int finished, int downloaded, int total) {
notifyDataChanged(index);
if (mSpiderQueen != null) {
mSpiderQueen.request(index, false);
}
}
@Override
@@ -418,8 +418,8 @@ public final class SpiderQueen implements Runnable {
return request(index, true, true, false);
}
public Object request(int index) {
return request(index, true, false, true);
public Object request(int index, boolean addNeighbor) {
return request(index, true, false, addNeighbor);
}
private int getPageState(int index) {
@@ -42,10 +42,6 @@ abstract class PageLoader {
state.compareAndSet(STATE_WAIT, STATE_READY)
}
fun notifyDataChanged(index: Int) {
onRequest(index)
}
fun notifyPageWait(index: Int) {
mPages[index].status.value = Page.State.QUEUE
}