Ensure story lists that start empty load something.

This commit is contained in:
dosiecki 2014-09-23 21:44:14 -07:00
parent 791782d436
commit eda5bf00df
3 changed files with 13 additions and 11 deletions

View file

@ -99,8 +99,8 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
@Override
public synchronized void onScroll(AbsListView view, int firstVisible, int visibleCount, int totalCount) {
// load an extra page or two worth of stories past the viewport
int desiredStoryCount = firstVisible + (visibleCount*2);
int desiredStoryCount = firstVisible + (visibleCount*2) + 1;
// this method tends to get called repeatedly. don't request repeats
if (desiredStoryCount <= lastRequestedStoryCount) {
return;

View file

@ -622,16 +622,18 @@ public class NBSyncService extends Service {
Log.e(NBSyncService.class.getName(), "rejecting request for feedset that is exhaused");
return false;
}
Integer alreadyRequested = PendingFeeds.get(fs);
if ((alreadyRequested != null) && (desiredStoryCount <= alreadyRequested)) {
return false;
}
Integer alreadySeen = FeedStoriesSeen.get(fs);
if ((alreadySeen != null) && (desiredStoryCount <= alreadySeen)) {
return false;
synchronized (PendingFeeds) {
Integer alreadyRequested = PendingFeeds.get(fs);
if ((alreadyRequested != null) && (desiredStoryCount <= alreadyRequested)) {
return false;
}
Integer alreadySeen = FeedStoriesSeen.get(fs);
if ((alreadySeen != null) && (desiredStoryCount <= alreadySeen)) {
return false;
}
}
Log.d(NBSyncService.class.getName(), "enqueued request for minimum stories: " + desiredStoryCount);
PendingFeeds.put(fs, desiredStoryCount);
NbActivity.updateAllActivities();
return true;

View file

@ -5,7 +5,7 @@ public class AppConstants {
// Enables high-volume logging that may be useful for debugging. This should
// never be enabled for releases, as it not only slows down the app considerably,
// it will log sensitive info such as passwords!
public static final boolean VERBOSE_LOG = true;
public static final boolean VERBOSE_LOG = false;
public static final boolean VERBOSE_LOG_DB = false;
public static final int STATE_ALL = 0;