diff --git a/clients/android/NewsBlur/src/com/newsblur/activity/Reading.java b/clients/android/NewsBlur/src/com/newsblur/activity/Reading.java index a0690bb4b..96ce730a3 100644 --- a/clients/android/NewsBlur/src/com/newsblur/activity/Reading.java +++ b/clients/android/NewsBlur/src/com/newsblur/activity/Reading.java @@ -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(); diff --git a/clients/android/NewsBlur/src/com/newsblur/database/ReadingAdapter.java b/clients/android/NewsBlur/src/com/newsblur/database/ReadingAdapter.java index e92ef9c7f..a144fbae3 100644 --- a/clients/android/NewsBlur/src/com/newsblur/database/ReadingAdapter.java +++ b/clients/android/NewsBlur/src/com/newsblur/database/ReadingAdapter.java @@ -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;