title: FirebaseIndexRecyclerAdapter onDataChanged is called but getItemCount() always return 0
body: <p>I'm using <a href="https://github.com/firebase/FirebaseUI-Android/blob/master/database/src/main/java/com/firebase/ui/database/FirebaseIndexRecyclerAdapter.java" rel="nofollow noreferrer"><code>FirebaseIndexRecyclerAdapter</code></a> which gets a keyRef and dataRef and is very helpful with getting all dataRef's children which their keys exists as children in keyRef.</p>
  
  <p>The data is being displayed correctly but if i'm overriding <code>onDataChanged</code> for hiding a progress bar and/or displaying an empty state depends on the itemsCount (Something which i've already done with <code>FirebaseRecyclerAdapter</code> and works as expected) but <code>getItemCount</code> always return 0(!)</p>
  
  <pre><code>private class MYAdapter extends FirebaseIndexRecyclerAdapter&lt;Item, ItemHolder&gt; {
      .
      .
  
      @Override
      protected void onDataChanged() {
          super.onDataChanged();
          // getItemCount() == 0 here always
      }
  
      .
      .
  }
  </code></pre>
  
  <p>I've investigate it and the reason is that <code>FirebaseIndexRecyclerAdapter</code> is using <code>FirebaseIndexArray</code> which is overriding <code>getItemCount</code> and return <code>mDataSnapshots.size()</code> but the data was not loaded yet - the <code>onDataChanged</code> was called because the keyRef loaded - and indeed i can see in debug that the keys are loaded (with the correct count) but unfortunately they are private so i can't use them to get the count.</p>
  
  <p>I know i can override <code>onChildChanged</code> and then call <code>getItemCount</code> and get the correct count (which i've done) but still i can't know if there are no items and i need to display the empty state.</p>
  
  <p>Using <code>com.firebaseui:firebase-ui:1.2.0</code></p>
  
  <p>Is there something i'm missing? </p>
  
  <p><strong>Note</strong> - I know i can manage my own count (child) beside the data and just load it before setting the adapter but i'm saving this as a last resort.</p>
  
  <p>Thanks!</p>