mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Ensure stories always load more buffer on start of reading activity. Ensure story load cancels quickly on return to feed list.
This commit is contained in:
parent
741c8bed20
commit
b637cc4697
1 changed files with 17 additions and 5 deletions
|
@ -425,10 +425,15 @@ public class NBSyncService extends Service {
|
|||
*/
|
||||
private void syncPendingFeedStories() {
|
||||
FeedSet fs = PendingFeed;
|
||||
if (fs == null) return;
|
||||
boolean finished = false;
|
||||
if (fs == null) {
|
||||
Log.i(this.getClass().getName(), "No feed set to sync.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (ExhaustedFeeds.contains(fs)) {
|
||||
Log.i(this.getClass().getName(), "No more stories for feed set: " + fs);
|
||||
finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -444,7 +449,12 @@ public class NBSyncService extends Service {
|
|||
|
||||
while (totalStoriesSeen < PendingFeedTarget) {
|
||||
if (stopSync()) return;
|
||||
if (!fs.equals(PendingFeed)) return; // the active view has changed
|
||||
|
||||
if (!fs.equals(PendingFeed)) {
|
||||
// the active view has changed
|
||||
if (fs == null) finished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
StorySyncRunning = true;
|
||||
NbActivity.updateAllActivities(false);
|
||||
|
@ -467,18 +477,20 @@ public class NBSyncService extends Service {
|
|||
|
||||
if (apiResponse.stories.length == 0) {
|
||||
ExhaustedFeeds.add(fs);
|
||||
finished = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finished = true;
|
||||
|
||||
} finally {
|
||||
synchronized (PENDING_FEED_MUTEX) {
|
||||
if (fs.equals(PendingFeed)) PendingFeed = null;
|
||||
}
|
||||
if (StorySyncRunning) {
|
||||
StorySyncRunning = false;
|
||||
NbActivity.updateAllActivities(false);
|
||||
}
|
||||
synchronized (PENDING_FEED_MUTEX) {
|
||||
if (finished && fs.equals(PendingFeed)) PendingFeed = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue