title: Endless RecyclerView with ProgressBar for pagination
body: <p>I am using a <a href="http://developer.android.com/reference/android/support/v7/widget/RecyclerView.html" rel="noreferrer"><code>RecyclerView</code></a> and fetching objects from an API in batches of ten. For pagination, I use <a href="https://gist.github.com/ssinss/e06f12ef66c51252563e" rel="noreferrer"><code>EndlessRecyclerOnScrollListener</code></a>.</p>
  
  <p>It's all working properly. Now all that's left is to add a progress spinner at the bottom of the list while the next batch of objects is fetched by the API. Here is a screenshot of the Google Play Store app, showing a <code>ProgressBar</code> in what is surely a <code>RecyclerView</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/g1gyA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/g1gyA.png" alt="enter image description here"></a></p>
  
  <p>The problem is, neither the <code>RecyclerView</code> nor the <code>EndlessRecyclerOnScrollListener</code> have built-in support for showing a <code>ProgressBar</code> at the bottom while the next batch of objects is being fetched.</p>
  
  <p>I have already seen the following answers:</p>
  
  <p><strong>1.</strong> <a href="https://stackoverflow.com/a/28090719/3287204"><strong>Put an indeterminate <code>ProgressBar</code> as footer in a <code>RecyclerView</code> grid</strong></a>.</p>
  
  <p><strong>2.</strong> <a href="https://stackoverflow.com/a/30691092/3287204"><strong>Adding items to Endless Scroll <code>RecyclerView</code> with <code>ProgressBar</code> at bottom</strong></a>.</p>
  
  <p>I am not satisfied with those answers (both by the same person). This involves shoehorning a <code>null</code>  object into the data-set midway while the user is scrolling and then taking it out after the next batch is delivered. It looks like a hack that sidesteps the main problem which may or may not work properly. And it causes a bit of jarring and distortion in the list</p>
  
  <p>Using <a href="http://developer.android.com/intl/ja/reference/android/support/v4/widget/SwipeRefreshLayout.html" rel="noreferrer"><code>SwipeRefreshLayout</code></a> is not a solution here. <code>SwipeRefreshLayout</code> involves pulling from the top to fetch the <em>newest</em> items, and it does not show a progress view anyway.</p>
  
  <p>Can someone please provide a good solution for this? I am interested in knowing how Google has implemented this for their own apps (the Gmail app has it too). Are there any articles where this is shown in detail? All answers &amp; comments will be appreciated. Thank you.</p>
  
  <p><strong>Some other references</strong>:</p>
  
  <p><strong>1.</strong> <a href="https://medium.com/@etiennelawlor/pagination-with-recyclerview-1cb7e66a502b#.amz3ekaxp" rel="noreferrer"><strong>Pagination with <code>RecyclerView</code></strong></a>. (Superb overview ...)</p>
  
  <p><strong>2.</strong> <a href="https://stackoverflow.com/q/26585941/3287204"><strong><code>RecyclerView</code> header and footer</strong></a>. (More of the same ...)</p>
  
  <p><strong>3.</strong> <a href="https://stackoverflow.com/q/33118143/3287204"><strong>Endless <code>RecyclerView</code> with <code>ProgressBar</code> at bottom</strong></a>.</p>