fix long-reused activities not loading on resume

This commit is contained in:
dosiecki 2017-05-03 23:12:58 -07:00
parent 48aa646cee
commit f3062cd959
2 changed files with 8 additions and 10 deletions

View file

@ -62,11 +62,6 @@ public abstract class ItemsList extends NbActivity implements StoryOrderChangedL
fs = (FeedSet) getIntent().getSerializableExtra(EXTRA_FEED_SET);
// this is not strictly necessary, since our first refresh with the fs will swap in
// the correct session, but that can be delayed by sync backup, so we try here to
// reduce UI lag
FeedUtils.prepareReadingSession(fs);
intelState = PrefsUtils.getStateFilter(this);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
@ -129,6 +124,10 @@ public abstract class ItemsList extends NbActivity implements StoryOrderChangedL
// Reading activities almost certainly changed the read/unread state of some stories. Ensure
// we reflect those changes promptly.
itemListFragment.hasUpdated();
// this is not strictly necessary, since our first refresh with the fs will swap in
// the correct session, but that can be delayed by sync backup, so we try here to
// reduce UI lag, or in case somehow we got redisplayed in a zero-story state
FeedUtils.prepareReadingSession(fs);
}
@Override

View file

@ -127,11 +127,6 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
fs = (FeedSet)getIntent().getSerializableExtra(EXTRA_FEEDSET);
// this is not strictly necessary, since our first refresh with the fs will swap in
// the correct session, but that can be delayed by sync backup, so we try here to
// reduce UI lag
FeedUtils.prepareReadingSession(fs);
if ((savedInstanceBundle != null) && savedInstanceBundle.containsKey(BUNDLE_STARTING_UNREAD)) {
startingUnreadCount = savedInstanceBundle.getInt(BUNDLE_STARTING_UNREAD);
}
@ -219,6 +214,10 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
// onCreate() in our subclass should have called createLoader(), but sometimes the callback never makes it.
// this ensures that at least one callback happens after activity re-create.
getLoaderManager().restartLoader(0, null, this);
// this is not strictly necessary, since our first refresh with the fs will swap in
// the correct session, but that can be delayed by sync backup, so we try here to
// reduce UI lag, or in case somehow we got redisplayed in a zero-story state
FeedUtils.prepareReadingSession(fs);
}
@Override