title: RecyclerView onScrollChangeListener
body: <p>I need to hide and show a floating action button while I scroll up and down a RecyclerView, I have implemented this successfully under SDK 23, code shown below (newReminder is the button I need to hide and show):</p>
  
  <pre><code>recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
  @Override
  public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
      super.onScrollStateChanged(recyclerView, newState);
  }
  
  @Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
      super.onScrolled(recyclerView, dx, dy);
  
      if (scrolledDistance &gt; HIDE_THRESHOLD &amp;&amp; !newReminder.isMenuButtonHidden()) {
          newReminder.hideMenuButton(true);
          scrolledDistance = 0;
      } else if (scrolledDistance &lt; -HIDE_THRESHOLD &amp;&amp; newReminder.isMenuButtonHidden()) {
          newReminder.showMenuButton(true);
          scrolledDistance = 0;
      }
  
      if((!newReminder.isMenuButtonHidden() &amp;&amp; dy&gt;0) || (newReminder.isMenuButtonHidden() &amp;&amp; dy&lt;0)) {
          scrolledDistance += dy;
      }
  }
  </code></pre>
  
  <p>});</p>
  
  <p>However, for SDK 23, when I use onScrollChangeListener I got confused with the parameters, my code below does not work any more:</p>
  
  <pre><code>if(Build.VERSION.SDK_INT &gt; 22){
  recyclerView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
      @Override
      public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) 
          if (scrolledDistance &gt; HIDE_THRESHOLD &amp;&amp; !newReminder.isMenuButtonHidden()) {
              newReminder.hideMenuButton(true);
          } else if (scrolledDistance &lt; -HIDE_THRESHOLD &amp;&amp; newReminder.isMenuButtonHidden()) {
              newReminder.showMenuButton(true);
          }
          if((!newReminder.isMenuButtonHidden() &amp;&amp; scrollY &gt; 0)
                  || (newReminder.isMenuButtonHidden() &amp;&amp; scrollY &lt; 0)) {
              scrolledDistance = oldScrollY - scrollY;
          }
      }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>I think I misunderstood what it meant by scrollY and oldScrollY, can anyone help me? Thanks!!!</p>