Skip to content

Commit

Permalink
* make sure we do not add the endless footer when the list is still s…
Browse files Browse the repository at this point in the history
…crolling
  • Loading branch information
mikepenz committed Feb 25, 2016
1 parent 939f80c commit f860097
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class EndlessScrollListActivity extends AppCompatActivity implements Item

//save our FastAdapter
private FastItemAdapter<SampleItem> fastItemAdapter;

private FooterAdapter<ProgressItem> footerAdapter;

//drag & drop
Expand Down Expand Up @@ -95,19 +94,25 @@ public boolean filter(SampleItem item, CharSequence constraint) {
recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener(manager, 15) {
@Override
public void onLoadMore(final int currentPage) {
footerAdapter.clear();
footerAdapter.add(new ProgressItem());
//simulate networking (2 seconds)
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
footerAdapter.clear();
for (int i = 1; i < 16; i++) {
fastItemAdapter.add(fastItemAdapter.getAdapterItemCount(), new SampleItem().withName("Item " + i + " Page " + currentPage));
}
footerAdapter.add(new ProgressItem());
//simulate networking (2 seconds)
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
footerAdapter.clear();
for (int i = 1; i < 16; i++) {
fastItemAdapter.add(fastItemAdapter.getAdapterItemCount(), new SampleItem().withName("Item " + i + " Page " + currentPage));
}
}
}, 2000);
}
}, 2000);
}, 10);

}
});

Expand Down

0 comments on commit f860097

Please sign in to comment.