title: How to find out that RecyclerView has finished update?
body: <p>I use SortedList in RecyclerView Adapter and I'd like to know when RecyclerView has finished its update after I change data in Adapter (and called proper method e.g. notifyItemRangeChanged). Is there any way to do this?</p>
  
  <p>My problem is that I need to scroll RecyclerView to the top after filtering its content. I call from Activity method on my Adapter which filter items on its member. After that I just call scrollToPosition(0) on RecyclerView and its not always work as expected, especially when after changes operation on list is only 1 item.</p>
  
  <p>Here is code of update method I call on my adapter:</p>
  
  <pre><code>private SortedList&lt;Game&gt; games;
  private ArrayList&lt;Game&gt; allGames;
  
  public void search(String query) {
      replaceAll(filterGames(query));
  }
  
  public void replaceAll(Collection&lt;Game&gt; games) {
      this.games.beginBatchedUpdates();
      List&lt;Game&gt; gamesToRemove = new ArrayList&lt;&gt;();
      for (int i = 0; i &lt; this.games.size(); i++) {
          Game game = this.games.get(i);
          if (!games.contains(game)) {
              gamesToRemove.add(game);
          }
      }
      for (Game game : gamesToRemove) {
          this.games.remove(game);
      }
      this.games.addAll(games);
      this.games.endBatchedUpdates();
  }
  
  private Collection&lt;Game&gt; filterGames(String query) {
      query = query.toLowerCase();
      List&lt;Game&gt; filteredGames = new ArrayList&lt;&gt;();
      for (Game game : allGames) {
          String gameTitle = game.getTitle().toLowerCase();
          if (gameTitle.contains(query)) {
              filteredGames.add(game);
          }
      }
      return filteredGames;
  }
  </code></pre>
  
  <p>And here how I call it from Activity:</p>
  
  <pre><code>private RecyclerView gamesList;
  private GameAdapter gamesAdapter;
  
  @Override
  public boolean onQueryTextChange(String newText) {
      gamesAdapter.search(newText);
      gamesList.scrollToPosition(0);
      return false;
  }
  </code></pre>