add comments

This commit is contained in:
dosiecki 2018-07-17 14:06:45 -07:00
parent 63c2679c33
commit 1753e2f07a
2 changed files with 10 additions and 1 deletions

View file

@ -270,8 +270,9 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
return;
}
//NB: this implicitly calls readingAdapter.notifyDataSetChanged();
if (readingAdapter != null) {
// swapCursor() will asynch process the new cursor and fully update the pager,
// update child fragments, and then call pagerUpdated()
readingAdapter.swapCursor(cursor, pager);
}
@ -284,6 +285,9 @@ public abstract class Reading extends NbActivity implements OnPageChangeListener
}
}
/**
* notify the activity that the dataset for the pager has fully been updated
*/
public void pagerUpdated() {
// see if we are just starting and need to jump to a target story
skipPagerToStoryHash();

View file

@ -24,6 +24,11 @@ import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* An adapter to display stories in a ViewPager. Loosely based upon FragmentStatePagerAdapter, but
* with enhancements to correctly handle item insertion / removal and to pass invalidation down
* to child fragments during updates.
*/
public class ReadingAdapter extends PagerAdapter {
private String sourceUserId;